dev-resources.site
for different kinds of informations.
How to squash Git commits
Published at
3/2/2020
Categories
git
commits
Author
olegchursin
Author
11 person written this
olegchursin
open
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
main
branch. - Run
git rebase -i main
. - 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
.
commits Article's
16 articles in total
My GitHub Profile
read article
The Art of Writing Effective Git Commits
read article
Cรณmo escribir excelentes commits
read article
How to fix unverified commits on GitHub
read article
GIT - Commits Semรขnticos
read article
Fix mistaken commits in Git ๐!
read article
Branches in Git
read article
Semantic GitHub
read article
Automating to copy a set of commits from one branch to another
read article
7 Git commands essential for contributing with a team
read article
What's in a useful commit message?
read article
How to squash Git commits
currently reading
Signing Git Commits/tags with GPG Keys
read article
Visualize types of work based on the commits
read article
Rebasing Toward Independence
read article
Creating co-authored commits--command line--git
read article
Featured ones: