Did you know that you can navigate the posts by swiping left and right?

Squashing git commits

05 Feb 2017 . category: devops . Comments
#git

Check the log to see how many commit you want to squash

git log
or
git log --oneline --graph --decorate --all


Rebase the amount of commits you want to squash

git rebase -i HEAD~<number of commits to squash>
git rebase -i HEAD~5

This will prompt you to pick commits.
You can use pick and squash or fixup for the rest.
(Squash will open an editor where you can rename your commit.)

Force push your squashed commit

git push -f <remote> <branch>
git push -f origin master



Me

Jeremy Miller is an awesome person. He lives in the Midwest, where he works in Linux Administration. In his spare time, Jeremy likes to develop.