Skip to content

Instantly share code, notes, and snippets.

@droberson
Created June 12, 2018 15:26
Show Gist options
  • Save droberson/0eddca819764cffd56532d461bcb7b3d to your computer and use it in GitHub Desktop.
Save droberson/0eddca819764cffd56532d461bcb7b3d to your computer and use it in GitHub Desktop.
Squashing multiple commits
1. git checkout -b squashed_branch
2. git rebase -i master
3. edit the file:
pick aaaaaaa commit message 1
pick bbbbbbb commit message 2
pick ccccccc commit message 3
...
->
pick aaaaaa commit message 1
squash bbbbbb commit message 2
squash cccccc commit message 3
...
4. if conflicts arise:
- git status ### see which file is messed up
- edit the affected file appropriately
- git add . ### git rm if you dont want the file anymore
- git rebase --continue
- repeat until no more conflicts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment