Skip to content

Instantly share code, notes, and snippets.

@tzkmx
Created December 9, 2021 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tzkmx/e946b32d3906c0d3c820f0bdb5b99e85 to your computer and use it in GitHub Desktop.
Save tzkmx/e946b32d3906c0d3c820f0bdb5b99e85 to your computer and use it in GitHub Desktop.
Split commits with git rebase
## Source: https://emmanuelbernard.com/blog/2014/04/14/split-a-commit-in-two-with-git/
### Split a commit in two for the busy onesPermalink
### Let’s see the sequence first before explaining it
git rebase -i <oldsha1>
# mark the expected commit as `edit` (replace pick in front of the line), save and close
git reset HEAD^
git add ...
git commit -m "First part"
git add ...
git commit -m "Second part"
git rebase --continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment