An Interest In:
Web News this Week
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
March 2, 2020 04:05 pm GMT
Original Link: https://dev.to/olegchursin/how-to-squash-git-commits-16lf
How to squash Git commits
A really quick step-by-step guide on how to squash Git commits to make your PRs concise, easy to read, and hence easy to review.
Steps:
- Make sure your branch is up to date with the master branch.
- Run
git rebase -i master
. - You should see a list of commits, each commit starting with the word "pick".
- Make sure the first commit says "pick" and change the rest from "pick" to "squash". -- This will squash each commit into the previous commit, which will continue until every commit is squashed into the first commit.
- Save and close the editor (press
Esc
key, type:w
and hitEnter
key) -- save a file and quit vim / Vi by pressingEsc
key, type:x
and hitEnter
key. - It will give you the opportunity to change the commit message.
- Save and close the editor again.
- Force push the squashed commit:
git push --force-with-lease origin
.
Original Link: https://dev.to/olegchursin/how-to-squash-git-commits-16lf
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To