31

What does "Changed but not updated mean"? These files are in git, they've been modified but when I run "git status," these changes appear under "Changed but not updated" instead of "Changes to be commited."

# On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: breakouts/views.py # # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: templates/registration/login.html # modified: templates/registration/registration.html # Untracked files: # (use "git add <file>..." to include in what will be committed) # # context_processors.py # static/#css.css# 

Since they've already been added why aren't they "Changes to committed"?

1
  • 1
    The key idea here, with git add, is that you prepare a commit, is that you put modifications into the staging area (index), and then once you've staged what you want to commit, you commit it. This lets you be very careful about what goes into any given commit. Commented Jan 27, 2011 at 6:24

3 Answers 3

24

You have to use git add every time OR use git commit -a or git commit --all instead of plain git commit.

from Git docs:

 -a --all Tell the command to automatically stage files that have been modified and deleted, but new files you have not told git about are not affected. 

add is basically the "take notice of this file/directory" command. Not CVS's or subversion's track changes to this file.

Sign up to request clarification or add additional context in comments.

1 Comment

note that in newer git versions (>1.8), the comment "Changed but not updated" was chagned to "changes not staged for commit"
6

Every time you modify a file, you have to add it using git add to be able to commit it, even if you did add it at the beginning.

Comments

3

The git add <file> adds the 'changes' to your local commit schedule, if those changes aren't added, then they aren't committed.

Why? This is git's workflow, just like anything there is terminology that is open to interpretation, perhaps you're used to SVN's idea of add, try to forego what you assume and learn how git does things.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.