[git] Go to particular revision

I was in a situation where we have a master branch, and then another branch called 17.0 and inside this 17.0 there was a commit hash no say "XYZ". And customer is given a build till that XYZ revision. Now we came across a bug and that needs to be solved for that customer. So we need to create separate branch for that customer till that "xyz" hash. So here is how I did it.

First I created a folder with that customer name on my local machine. Say customer name is "AAA" once that folder is created issue following command inside this folder:

  1. git init
  2. git clone After this command you will be on master branch. So switch to desired branch
  3. git checkout 17.0 This will bring you to the branch where your commit is present
  4. git checkout This will take your repository till that hash commit. See the name of ur branch it got changed to that commit hash no. Now give a branch name to this hash
  5. git branch ABC This will create a new branch on your local machine.
  6. git checkout ABC
  7. git push origin ABC This will push this branch to remote repository and create a branch on git server. You are done.