Moves local commits from the master
branch to a new branch.
git branch <branch>
to create a new branch at the tip of the current master
.git reset HEAD~<n> --hard
to rewind back <n>
commits and discard changes.git checkout <branch>
to switch to the new branch.git branch <branch>
git reset HEAD~<n> --hard
git checkout <branch>
git checkout master
git add .
git commit -m "Fix network bug"
git branch patch-1
# `patch-1` branch is created containing the commit "Fix network bug"
git reset HEAD~1 --hard # Remove the commit from `master`
git checkout patch-1
Git, Repository
Resets the local master
branch to match the one on the remote.
Git, Branch
Forces an update of the remote branch after rewriting the history locally.
Git, Branch
Prints all the branches containing a specific commit.