What happened to this git commit? Issue with “untracked files”

I just helped a developer on my team fix up a git commit that somehow got munged in his local repo. You can see from the Git Extensions screenshot below that 11 hours ago he did a commit, which he thought included all his changes. He found this morning though that a bunch of files were missing from his working copy on his filesystem. Looking in the repo, these were in the commit “untracked files on master.” After some playing with branching and merging, I got them back into the master branch, and things seem to be fine now.

Any ideas on what happened during his commit to create this scenario? These files are not in .gitignore — the .gitignore checkins you see below are an attempt to get the silverstripe-cache folder contents ignored.

  • Git GUI Crash Signal 6
  • git svn ambiguous argument 'HEAD'
  • Find out git branch creator
  • Git bogus 'Pull is not possible' message
  • Cannot continue git rebase
  • Error - “There is no script engine for file extension .vbs” when using “Git Bash Here” in Windows 7
  • We’re new to git over here so appreciate the assist.

    Git Repo History

  • Merge to remote branch avoiding code to be changed
  • Deploy a pre existing django git repo to heroku
  • Identify all commits made in a push
  • unable to pull .gitignore file
  • remote branching after the fact
  • Revert a merge commit from a protected branch on GitHub.com
  • 2 Solutions collect form web for “What happened to this git commit? Issue with “untracked files””

    “untracked files on master” are not in any commit, i.e. they only exist in your file system and you never told git to track them. In order to fix that do “git add ” for all those you want to add to the incomplete commit and then do “git commit –amend” (assuming the commit to be amended is still the one your currently checked out branch points at).

    From the look of the branches (dots and lines left of the commit messages), it looks like the commit “untracked files on master” was not made on the same branch as the other commits.

    You would have to look further back in the history to check if there was indeed a fork in the history of the “master” branch.

    Blind guesses as to how this could happen :

    • the first commit was done from a different machine, pushed to a central repo, but your colleague forgot to pull (or thought he had, but instead had a weird error message),
    • git checkout <branch> and git checkout -b <branch> have a completely different meaning, and it can confuse new users – it took me one or two surprises to find out ;).
    Git Baby is a git and github fan, let's start git clone.