Reputation: 41
Searched for this specific issue, haven't been able to find anything relative. I've cloned a repository, no issue - git 'status' returns on master branch and clean. I then checkout a particular branch, say 'dev'. I then fetch n pull (nothing to do). OK... fine...
$> git checkout -b bug_000120
No issues, now on branch 'bug_000120' and ready to do some quick changes. After modifying file(s), I quickly check the status...
$> git status
# On branch bug_000120
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: core/user_manager.class.php
#
no changes added to commit (use "git add" and/or "git commit -a")
I don't get this... no changes to commit?!? Add the file? It already existed prior to the modifications...
With all due respect, anyone? Something cement-headed I'm overlooking? I'm just at a loss... or is this expected?!? I would think the changes would be staged for commit and then push...
Any/all comments are greatly appreciated and welcomed!
Thanx in advance...
Upvotes: 0
Views: 4800
Reputation: 503
I would think the changes would be staged for commit
That's what git add
does, actually. git add file
means "Add file
to the commit I'm about to make". If the file didn't exist in the repository, the commit will add it. If it did exist, the commit will consist of changing the file instead.
This allows you to only multiple files without having to commit all of them at the same time - you would just git add
the ones that you want to commit and leave the rest of them alone.
You can take a look at the documentation. There's also a nice tutorial by Atlassian.
Upvotes: 3