Unlike many other VCSs, Git encourages workflows that branch and merge often, even multiple times in a day. All you have to do is switch back to your master branch. $ git checkout Switch to the branch "issue1" by doing the following. By default, when you use git branch -v option, it will display the first 7 character of the sha1 commit value for the branch as shown below. $ git checkout -b And the final step is to move the commits that follow to the new branch: git checkout -b newbranch. They’re local references that you can’t move; Git moves them for you whenever you do any network communication, to make sure they accurately represent the state of the remote repository. For example, if we want to reset master to point to the commit two back from the current commit, we could use either of the following methods: $ git reset 9ef9173 (using an absolute commit SHA1 value 9ef9173). For this reason, git branch is tightly integrated with the git checkout and git merge commands. git branch -a --no-color git branch -a --color=never 13. Step (2) creates a new branch that uses the source branch as its starting point. $ git checkout Switch to the branch "issue1" by doing the following. commit 6 [my-feature-branch] commit 5; commit 2 [production] commit 1 Regardless of … You can always do a git reset .Perhaps the easiest way to do this is use a graphical frontend, i.e. a branch specific to the task you're working on)? git checkout commit_name in the commit name pass the commit id and if you don't want to checkout again then to revert the commit will do by this one git revert commit_name. Use git filter-branch to move all projects files to a subdir and rewrite all commits - git-filter-branch-move-files.md. You decided you'd rather make those changes in "dev_branch". The process for moving work off one branch and onto a newly created branch is the simplest of the two operations. git checkout git checkout -b git checkout HEAD~X // x is the number of commits t go back This will checkout new branch pointing to the desired commit. Then undo the commits with  git reset HEAD~N where “N” is the number of commits you want to undo. Here's how to move those uncommitted changes to "dev_branch" and then revert "master" to its last commit. git checkout; git branch; git reset –hard HEAD~1; In step (1) we make sure that we are on our “source branch” – the branch that has the commits we want to move to a new branch. It doesn’t let you switch between branches or put a forked history back together again. Merging is Git's way of putting a forked history back together again. What happens if we want to roll back to a previous commit. Note that all of the commands presented below merge into the current branch. Then reset your current branch back by one commit (or however many commits you need to go back): git reset --hard HEAD~1. The git merge command lets you take the independent lines of development created by git branch and integrate them into a single branch.. Why is it so special? Use the checkout command to switch branch. This includes both code snippets embedded in the card text and code that is included as a file attachment. Use git log to check how many commits you want to roll back. By passing in the -b option when executing the checkout command, a new branch will be created and you will be switched over thereafter. Now you get the call that there is an issue with the website, and you need to fix it immediately. At this point you can create a branch and start to work from this point on: # Checkout a given commit.