PositiveGuy
PositiveGuy

Reputation: 20262

Git doesn't track changes in existing file

I must admit I'm still kinda a beginner with git.

I've got a .feature file for cucumber sitting here that I changed quite a bit in code.

I was ready to commit, here was my workflow, the commands I performed in order and the result:

git status

On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   ../package.json

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:   ../gulpfile.js
        modified:   ../package.json
        modified:   features/some.feature
        modified:   features/step_definitions/some.js

So now I am wondering if this is saying my modified files some.feature and some.js isn't being picked up and staged? It's not looking like my commit is picking up those changes?? Maybe I just misunderstood git here...

And I did a git add, why isn't it staging the gulpfile.js and package.json changes? the package.json is not a new file, I commited that already in the past but the gulpfile.js is something new I introduced in my working directory.

Upvotes: 3

Views: 1992

Answers (1)

David Deutsch
David Deutsch

Reputation: 19035

The reason it is not staging gulpfile.js and package.json is because they were not in the directory (or below it) when you did git add ., which only adds files in the current directory and below. If you cd .. and do a git add ., they will be added.

Upvotes: 4

Related Questions