Accept all cookies Customize settings.
Aug 10, Nothing to commit, working tree clean after calling git checkout. Ask Question Asked 3 years ago. Active 3 years ago. Viewed 6k times By doing git checkout you went into so called"detached head" state, which in simple terms means you're not on any branch right now.
If you want to return to your normal branch just do.git status HEAD detached at 8fd nothing to commit, working tree clean This means that at some point, you've run git checkout on a specific commit.
In Git, the checkout command is often used for switching between between branches, i.e. git checkout master, but it can also be used to change your working copy to the state is was in a certain commit. 1. We start off with a clean repository. Doing “git status” shows. git status # On branch master nothing to commit, working directory clean.
This is a good state, this is what we like to see. 2. We make a change to a file in our repository (without branching, which is what we should have done). This exact state - when a specific commit is checked out instead of a branch - is what's called a"detached HEAD".
The problem with a detached HEAD. The HEAD pointer in Git determines your current working revision (and thereby the files that are placed in your project's working directory). Normally, when checking out a proper branch name, Git automatically moves the HEAD pointer along when you create a new commit. You're in"detached HEAD" mode. You get that any time you explicitly check out something that is not a (local) branch name:git checkout origin/master # detach to"remote branch".
or if there's a tag vgit checkout v # detach to tag. and you can even explicitly detach when using a local branch name. Sep 21, The “nothing to commit, working directory clean” message tells us all of the changes we have made to a Git repository are committed. This means the current state of our project folder is exactly the same as that of the last commit. When you add, remove, or Estimated Reading Time: 4 mins.