
This means that when you make changes and commit them, these changes do NOT belong to any branch. When you instead choose to check out a specific commit hash, Git will NOT do this for you. Normally, when checking out a branch, Git automatically moves the HEAD pointer along when you create new commits: you're automatically and always on the newest commit of the chosen branch. The HEAD pointer in Git determines your current working revision (and thereby the files that are placed in your project's working directory). In case you are using the Tower Git client, you can simply right-click any commit and choose "Check Out " from the contextual menu: The Detached HEAD State However, you are now also in a state called "Detached HEAD". You will then have that revision's files in your working copy. To checkout a specific commit, you can use the git checkout command and provide the revision hash as a parameter: $ git checkout 757c47d4 Maybe you want to experiment with a specific, old revision and therefore need to have that revision's files in your working copy folder. There are very few reasons to checkout a commit (and not a branch). In case you are using the Tower Git client, you can double-click the branch you want or (in case you have lots and lots of branches) simply use the "Quick Action" dialog to enter the branch's name, not using the mouse at all: Checking Out Commits Any new commits you make from this point on (until you switch branches again) will be recorded in this branch's context. This branch will then be your current working branch, also referred to as "HEAD" in Git. With the git switch command (or, alternatively, the git checkout command), you can simply provide the name of the branch you want to checkout.
GIT COMMIT NEW FILES HOW TO
Here's how to do this: $ git switch my-branch As said, most of the time you'll want to "checkout" branches, and not individual commits.

This makes branches a very safe and convenient tool in Git.

The user does not have to do this manually. This also means that, if a new commit is made in that context, the branch pointer is automatically moved to that newest commit. This means that, actually, branches don't point to a certain commit but really always to the latest commit on the corresponding branch. Branches are very practical because they are pointers to the latest commit in a certain context (it helps to think of branches simply as specific, separate contexts with names). Most of the time, you will want to checkout a branch (and not a specific revision).
