Term used in version control systems that means combining several commits into one. Most often seen with git.
Questions tagged [squash]
286 questions
5196
votes
45 answers
How do I squash my last N commits together?
How do I squash my last N commits together into one commit?

markdorison
- 139,374
- 27
- 55
- 71
828
votes
12 answers
How to squash commits in git after they have been pushed?
This gives a good explanation of squashing multiple commits:
http://git-scm.com/book/en/Git-Branching-Rebasing
but it does not work for commits that have already been pushed. How do I squash the most recent few commits both in my local and remote…

Loren
- 13,903
- 8
- 48
- 79
736
votes
24 answers
How to squash all git commits into one?
How do you squash your entire repository down to the first commit?
I can rebase to the first commit, but that would leave me with 2 commits.
Is there a way to reference the commit before the first one?

Verhogen
- 27,221
- 34
- 90
- 109
669
votes
9 answers
Squash the first two commits in Git?
With git rebase --interactive you can squash any number of commits together into a single one.
That's all great unless you want to squash commits into the initial commit. That seems impossible to do.
Are there any ways to achieve…

kch
- 77,385
- 46
- 136
- 148
594
votes
6 answers
What is the difference between merge --squash and rebase?
I'm trying to understand the difference between a squash and a rebase. As I understand it, one performs a squash when doing a rebase.

GiH
- 14,006
- 13
- 43
- 56
179
votes
8 answers
How do you squash commits into one patch with git format-patch?
I've got eight commits on a branch that I'd like to email to some people who aren't git enlightened, yet. So far, everything I do either gives me 8 patch files, or starts giving me patch files for every commit in the branch's history, since the…

skiphoppy
- 97,646
- 72
- 174
- 218
178
votes
8 answers
What's the difference between "squash" and "fixup" in Git/Git Extension?
I've been using Git Extensions for a while now (it's awesome!) but I haven't found a simple answer to the following:
Sometimes, when typing a commit message, a make a typo. My friend showed me how to fix it the following way (in Git…

Placeholder
- 4,651
- 6
- 33
- 35
147
votes
8 answers
Is there a way to squash a number of commits non-interactively?
I'm trying to squash a range of commits - HEAD to HEAD~3. Is there a quick way to do this, or do I need to use rebase --interactive?

Phillip
- 5,366
- 10
- 43
- 62
100
votes
4 answers
Merging a branch of a branch after first branch is squashed when merged to master
Here's a workflow that I commonly deal with at work.
git checkout -b feature_branch
# Do some development
git add .
git commit
git push origin feature_branch
At this point the feature branch is up for review from my colleagues, but I want to keep…

Mike
- 1,625
- 3
- 16
- 19
96
votes
4 answers
Squash all my commits into one for GitHub pull request
I made a pull request on GitHub. Now the owner of the repository is saying to squash all the commits into one.
When I type git rebase -i Notepad opens with the following content:
noop
# Rebase 0b13622..0b13622 onto 0b13622
#
# Commands:
# p, pick…

omerjerk
- 4,090
- 5
- 40
- 57
87
votes
1 answer
How does the new Docker --squash work
In Docker 1.13 the new --squash parameter was added.
I'm now hoping to reduce the size of my images as well as being able to "hide" secret files I have in my layers.
Below you can now see the difference from doing a build with and without the…

Fore
- 5,726
- 7
- 22
- 35
81
votes
1 answer
What are the differences between `--squash` and `--no-ff --no-commit`?
Which one should one use to hide microcommits?
Is the only difference between git merge --squash and git merge --no-ff --no-commit the denial of the other parents?

Tobias Kienzler
- 25,759
- 22
- 127
- 221
70
votes
3 answers
Differences between Git merge --squash and --no-commit
As the title says, I am not really clear about the differences between a git merge --squash and a git merge --no-commit.
As far as I understand the help page for git merge, both commands would leave me in an updated working-tree, where it is still…

quaylar
- 2,617
- 1
- 17
- 31
62
votes
6 answers
git rebase interactive: squash merge commits together
I wanted to have a simple solution to squash two merge commits together during an interactive rebase.
My repository looks like:
X --- Y --------- M1 -------- M2 (my-feature)
/ / /
/ / /
a ---…

Mildred
- 3,887
- 4
- 36
- 44
48
votes
3 answers
Git squash all commits in branch without conflicting
A common development workflow for us is to checkout branch b, commit a bunch to it, then squash all those commits into one (still on b).
However, during the rebase -i process to squash all the commits, there are frequently conflicts at multiple…

Andy Ray
- 30,372
- 14
- 101
- 138