6
This happened because you checked out a commit.
You probably should have executed this command git checkout a83c7867c2
.
Git has a guy named HEAD. HEAD points to the current branch. It’s through HEAD that we know which branch we’re working on. The normal behavior is that HEAD is always pointing to some branch and the branch points to the last commit. When checking directly into a commit, HEAD will point directly to a commit. This situation features a Detached HEAD.
Anthony Accioly’s solution solves your problem.
git checkout master
However, if you commit to HEAD, which is what it looks like, your commits will be on a separate branch. They won’t appear in the master. The solution to this would be to create a branch that points to the last of these commits and then merge with the master. The command sequence would be:
git checkout -b outra-branch
(creating a new branch that points to the commit that HEAD is pointing to)git checkout master
(returning to the master branch)git merge --no-ff outra-branch
(bringing the changes from the other branch to the master)git branch -d outra-branch
(if the branch is no longer needed, it can be removed)
If you don’t want to lose commits made on a Detached HEAD, you should create a branch that points to them. If a checkout is run on a branch, and those commits are loose, at some point, Git’s Garbage Collection will remove them.
explanatory!
– RXSD