Difference between revisions of "Git Snippet: Move commit to existing branch"

From Coder Merlin
(Created page with "git checkout existingbranch git merge master git checkout master git reset --hard HEAD~3 # Go back 3 commits. You *will* lose uncommitted work. git checkout existingbranch")
 
 
Line 1: Line 1:
<syntaxhighlight lang="bash">
git checkout existingbranch
git checkout existingbranch
git merge master
git merge master
Line 4: Line 5:
git reset --hard HEAD~3 # Go back 3 commits. You *will* lose uncommitted work.
git reset --hard HEAD~3 # Go back 3 commits. You *will* lose uncommitted work.
git checkout existingbranch
git checkout existingbranch
</syntaxhighlight>

Latest revision as of 13:22, 13 January 2022

Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder
git checkout existingbranch
git merge master
git checkout master
git reset --hard HEAD~3 # Go back 3 commits. You *will* lose uncommitted work.
git checkout existingbranch