Created
December 9, 2021 07:46
-
-
Save tzkmx/e946b32d3906c0d3c820f0bdb5b99e85 to your computer and use it in GitHub Desktop.
Split commits with git rebase
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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