Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make a new branch from master then revert master back to certain commit

Tags:

git

I would like to make a branch from master then revert master back to a certain point. How can this be achieved with git?

like image 760
Chris Ledet Avatar asked Jul 25 '11 20:07

Chris Ledet


People also ask

How do I rollback to a specific commit?

To undo changes associated with a specific commit, developers should use the git revert command. To undo every change that has happened since a given commit occurred, use git reset.

How do I revert a commit in master branch?

In order to revert the last Git commit, use the “git revert” and specify the commit to be reverted which is “HEAD” for the last commit of your history.


1 Answers

git checkout master
git branch newBranch
git reset shaToResetMasterTo

like image 102
Andy Avatar answered Oct 11 '22 19:10

Andy