Skip to content

Instantly share code, notes, and snippets.

@chathudan
Last active August 29, 2015 14:19
Show Gist options
  • Save chathudan/2177489376fc56facbf2 to your computer and use it in GitHub Desktop.
Save chathudan/2177489376fc56facbf2 to your computer and use it in GitHub Desktop.
Git Tips

create a new git branch from an old commit

This will create the new branch and check it out.

git checkout -b development a9c146a09505837ec03b

This development the branch without checking it out.

git branch development a9c146a09505837ec03b

Rollback to an old commit using

git checkout [revision] .

where [revision] is the commit hash (for example: 12345678901234567890123456789012345678ab ).
Don't forget the . at the end--very important. This will apply changes to the whole tree. Then commit and you should be good.
You can undo this by git reset -- .; git checkout -- . . That will first remove the changes from the staging area, then remove all modifications from the working copy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment