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.

We’re new to git over here so appreciate the assist.

Git Repo History

  • Git pull fails : unable to update local ref
  • Using remote host as working directory, git extensions
  • git extensions displays multiple “branches” even If i select only one
  • GIT says I have no commits in repo — how to recover?
  • unable to clone git repository on laptop, however, cloned successfully on dev machine
  • How can I specify which branch should be checked out in a fresh clone?
  • Why is my Git Extensions Graph totally gray and how can I fix it?
  • Visual studio 2010 git extention manage remotes unable to connect
  • 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.