0

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...

Doktor13
  • 41
  • 1
  • 6
  • 3
    Not to be rude, but consider reading an introductory git tutorial? – Ismail Badawi Feb 17 '16 at 22:13
  • Related: http://stackoverflow.com/questions/25351450/what-does-adding-to-the-index-really-mean-in-git – jub0bs Feb 17 '16 at 22:26
  • Thanx, Jobobs... I experienced 'mental flatulence' when switching branches to get this hotfix worked out... See my reply below to Roujo... \m/ ;-) ,,, – Doktor13 Feb 17 '16 at 23:13

1 Answers1

3

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.

Roujo
  • 503
  • 4
  • 12
  • 1
    That's what I was originally thinking, I merely got confused... I had been working on another branch for so long the status message just had me momentarily taken aback when I had to quickly do this hotfix... (D'oh!) Thanx for the clarification, Roujo... more coffee for me... *winks* – Doktor13 Feb 17 '16 at 23:10