DEV Community

Cover image for Git Commit Split: Shell Command Quick Reference
Kenta Takeuchi
Kenta Takeuchi

Posted on • Originally published at bmf-tech.com

Git Commit Split: Shell Command Quick Reference

This article was originally published on bmf-tech.com.

Notes on how to split a commit in Git. Occasionally needed.

// Specify the point to split. Edit the target commit.
git rebase -i HEAD~5
Enter fullscreen mode Exit fullscreen mode
// The target commit is unstaged
git reset HEAD~
Enter fullscreen mode Exit fullscreen mode
// Add & commit at any granularity
git add ~
git commit ~
Enter fullscreen mode Exit fullscreen mode
git rebase --continue
Enter fullscreen mode Exit fullscreen mode

Top comments (0)