Zathrus Writer
Zathrus Writer

Reputation: 4331

Git says "new commits" but none can be found in the folder

Strange thing that I couldn't find an answer for. I don't really know how this happens only that it does for the past couple of weeks.

I keep seeing a folder that has "(new commits)" at the end when I do git status but I'm sure I've done no changes to it. Also, when I cd into the folder and do git status from there, git tells me there are no changes present.

When I do commit this folder, I'm ok for a day or two, then it comes back. Could be that it comes back after I do a git pull, as it's a shared project and I didn't really check this behaviour yet.

Any ideas?

enter image description here

Upvotes: 3

Views: 89

Answers (1)

cdhowie
cdhowie

Reputation: 169038

This indicates that the mockery directory is a submodule, you have created new commits in the directory, and you have not updated the repository containing the submodule to point to the latest commit in the submodule's repository. Note that submodules point to specific commits in a repository, not just some remote repository URL. This ensures that when you clone a repository containing submodules, you get the exact same code that the author was using (or that the author declared he was using -- as you can see here, it's possible not to tell the "parent" repository about the new commits).

git add mockery will instruct Git to use the current HEAD commit in the submodule as the submodule's commit identifier. This is a versioned change, so you will have to commit the result.

Upvotes: 3

Related Questions