git - squish commits w/o rebasing
git reset head~n
git add -A
git commit -m "new commit message"
Where n is the number of your last commits you want to merge
For example if you want to merge your last 3 commits into 1:
git reset head~3
git add -A
git commit "I merged my last 3 commits"
Caveats:
- This only works if all n commits are the last n commits in the repo.
- Any changes to your working directory will also be committed so only do this when you have a clean working tree.
Written by JD Isaacks
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#