Term used in version control systems that means combining several commits into one. Most often seen with git.
Questions tagged [squash]
286 questions
12
votes
3 answers
Why doesn't `git merge --squash` make a commit?
When doing a normal merge, e.g. git merge , git creates a merge commit and updates the HEAD of the current branch to that commit.
When doing a squash merge, e.g. git merge --squash, however, it does not make a commit, saying (on a…

Luke
- 7,110
- 6
- 45
- 74
12
votes
2 answers
How can I rebase as one commit using Git
My history looks somewhat like this but times 10:
i - j - e'- k - h'- l - m feature-branch
/
a - b - c - d - e - f - g - h master
(the apostrophes meaning cherry picks)
I want to rebase to this:
…

ZMitton
- 294
- 2
- 9
12
votes
1 answer
Git squash commits of renamed files (an keep history)
Backround
Hi, I'm working on a local feature branch. This local branch is messed up with lots of small commits. Before pushing the branch to the remote I would like to tidy things up.
For this I'd do a interactively rebase:
git rebase -i
No problem…

RamNow
- 456
- 5
- 16
11
votes
2 answers
What are the proper use cases of "git merge --squash"?
Some people like git merge --squash due to the reason as follows:
Squashing to a single commit gives you an opportunity to clean up messy WIP commits and provide a good rationale for the changes your are…

Tomoyuki Aota
- 867
- 9
- 18
10
votes
1 answer
How to squash a lot of commits automatically?
I have a lot of commits that I want to squash together into one commit. Of course I may replace pick with squash for every commit, but I have a hundreds commits.
Is there a way to do this automatically?

Bartłomiej Semańczyk
- 59,234
- 49
- 233
- 358
10
votes
2 answers
Checking if a Git branch has been merged into master when SQUASHED?
I'd like to automate cleaning of remote branches. I want to be able to check to see if a branch has been merged into master already. Originally, my plan was to use git merge-base to see the last common commit.
However, it turns out that we squash…

Emily Xie
- 173
- 1
- 8
10
votes
3 answers
git subtree push --squash does not squash
I am using git subtree to organize my git repositories. Let's say I have a main repository called repo and a library called lib.
I successfully "imported" the lib repository by squashing its history. I would now like to contribute back to lib by…

ibizaman
- 3,053
- 1
- 23
- 34
10
votes
3 answers
Rewrite a merge commit into a squash merge commit
I made a merge of a long lived branch and it took me time to complete the merge because of the conflicts resolution.
I found out that I cannot publish my work with git-svn: git svn rebase will rebase all the commits of the merged branch instead of…

Marc
- 609
- 1
- 5
- 10
9
votes
2 answers
github commits pile up after squash merge of pull request
I have a fork of another repo @github.
did some code and issued a pull request to upstream
upstream master merged with squash option
now next pull request includes new code and the older commits as well. So they increasingly pile up.
What can I…

Alexander T
- 115
- 7
9
votes
2 answers
How can I delete all local branches which would result in no changes if merged into master?
I know how to delete all local branches that have been merged. However, and I believe this is due to Github's new pull request squash and merge feature, I find myself being left with a lot of local branches that are unmerged, but if merged into…

Claudiu
- 224,032
- 165
- 485
- 680
9
votes
3 answers
Combine or rebase an arbitrarily large number of commits
Let's say my local git log shows:
739b36d3a314483a2d4a14268612cd955c6af9fb a
...
c42fff47a257b72ab3fabaa0bcc2be9cd50d5c89 x
c4149ba120b30955a9285ed721b795cd2b82dd65 y
dce99bcc4b79622d2658208d2371ee490dff7d28 z
My remote git log…

theanine
- 986
- 3
- 10
- 21
8
votes
1 answer
Squashing (already pushed) commits on GitLab
I have a merge request with 5 commits, all pushed to the branch on GitLab. I'd like to squash those 5 commits into 1 -- but there are intermediate commits to the repo by other people. E.g.,in git log, you might…

user319407
- 173
- 1
- 2
- 4
8
votes
1 answer
What happens to git history if multiple people work on a feature branch but it is squash and merged into master?
If multiple people work on a feature branch together, what will happen when you squash and merge it into master? Will git blame keep track of who worked on which part of the feature? Or will the person who clicks squash and merge be pointed to for…

Josh Wang
- 521
- 7
- 17
7
votes
1 answer
How to squash commits using eclipse?
I always use command prompt to squash multiple commits, and i was wondering how i can do it using eclipse!
I have looked for this answer , and i have not found something useful yet.

Sara.s
- 71
- 1
- 4
7
votes
1 answer
Can I squash _other peoples_ git commits in a submitted PR?
I have received a PR and wish to squash the commits so it's nice.
I'm not sure if I can do it or the respective authors have to do it? Of course, I wish to keep the author's name referencing their squash commit.
NOTE: this question is not about me…

Pure.Krome
- 84,693
- 113
- 396
- 647