I just pushed some changes to my main branch. Now I want to remove the last push from the main branch and move it to a new branch. Is there any command for that?
Asked
Active
Viewed 83 times
1 Answers
1
There is the git-cherry pick for this task.
git cherry-pick <SHA-1>
Apply the change introduced by the commit(s) at the tip of the master branch and create a new commit(s) with this change.
The syntax of the ...
is a commit range. grab all commits from start (exclude) to the last one. If you want a single commit use a single SHA-1
Once you have the desired commit to the desired branch remove it with one of teh following as described in here:
How to move HEAD back to a previous location? (Detached head)
git checkout
git reset
Read out the full git cherry-pick
documentation for all the options you can use

Community
- 1
- 1

CodeWizard
- 128,036
- 21
- 144
- 167