Term used in version control systems that means combining several commits into one. Most often seen with git.
Questions tagged [squash]
286 questions
44
votes
5 answers
Git squash history after merge
I merged an upstream of a large project with my local git repo. Prior to the merge I had a small amount of history that was easy to read through, but after the merge a massive amount of history is now in my repo. I have no need for all the history…

E-rich
- 9,243
- 11
- 48
- 79
39
votes
4 answers
Why can't I use git merge --squash with --no-ff?
I'm trying to use the git merge --squash with the --no-ff parameter, but git does not allow.
Someone have any sugestion to help me?
I can't use fast forward merge and I need to use the --squash parameter to group a lot of commits that were made in…

Guilherme Chiara
- 1,154
- 2
- 12
- 15
33
votes
3 answers
How to use interactive rebase on the first (root) commit of a branch?
If I'm in the following situation,
$ git log --oneline
* abcdef commit #b
* 123456 commit #a
I know I can always run
$ git reset HEAD~
$ git commit --amend
However, I tried to run
$ git rebase -i HEAD~2
but I got
fatal: Needed a single…

Shubham Chaudhary
- 47,722
- 9
- 78
- 80
29
votes
4 answers
How can I squash a range of git commits together given starting and ending SHA's
I have a branch with about 20 commits.
The first SHA on the branch is bc3c488...
The last SHA on the branch is 2c2be6...
How can I merge all the commits together?
I want to do this without using interactive rebase as there are so many commits.
I…

Michael Durrant
- 93,410
- 97
- 333
- 497
29
votes
1 answer
Git branch --merged / --no-merged and --squash option
git branch --merged doesn't appear to play nicely with --squash.
If you do a normal git merge, then git branch --merged tells you which branches have been merged. This is not the case however if the --squash option is used, even though the…

EdwardG
- 2,029
- 2
- 15
- 15
28
votes
2 answers
Git: How to rebase and squash commits from branch to master?
I'm trying to rebase and squash all my commits from current branch to master. Here is what I'm trying to do:
git checkout -b new-feature
make a couple of commits, after it I was trying:
git rebase -i master
in this case commits will remain in…

Viacheslav Kondratiuk
- 8,493
- 9
- 49
- 81
27
votes
8 answers
Git - squash entire branch - one line squash command
Whilst I am working on new code, I make many small commits to track my changes. My company, however, prefers each feature to be committed as a single commit. So the solution is to squash my entire (local) branch down to a single commit.
How do I…

troymass
- 1,022
- 3
- 11
- 24
26
votes
4 answers
Squash commits directly on feature without rebase or merge
I've been reading a little about --squashing commits, but they all seem to be go hand in hand with a --rebase.
I have a feature branch with a set of commits like this:
(Feature) A --> B --> C --> D --> E --> F --> G
…

Vivendi
- 20,047
- 25
- 121
- 196
23
votes
3 answers
Git - Difference between amend and squash commands
What is the difference between amend and squash commands? I tried both and found that both are doing the same for proper management.

Raju Guduri
- 1,237
- 1
- 13
- 25
21
votes
2 answers
Github "Squash and Merge" - subsequent pull request showing all previous changes
I have a branch which I pulled from master branch. Let's call it integration.
In the integration branch, I made various commits (C1, C2, C3). When I am done, I made a Pull Request to the master branch. From the master branch, I did a "Squash and…

some user
- 876
- 1
- 12
- 26
20
votes
2 answers
Is squashing commits into one best practice (for this particular workflow)?
I have the following git workflow:
Create new feature branch
Work on feature branch
Commit often
Once feature is complete, merge into master branch
Rinse and repeat
However, sometimes, I have the need to revert a whole feature from master. This…

Fillip Peyton
- 3,637
- 2
- 32
- 60
18
votes
6 answers
git interactive rebase squash into next commit
In Git I can use an interactive rebase to re-write history, this is great because in my feature branch I made a ton of commits with partially working code as I explored different refactors and ways of getting it done.
I'd like to squash a lot of the…

Josh R
- 1,970
- 3
- 27
- 45
16
votes
1 answer
squash more then two commits in sourcetree?
I have a large number of commits, about 20, that I've done since my last push to origin/master. I have never had more than one branch, master, and all commits were done on master. How can I squash all 20 commits into one commit, preferably using…

mark-hahn
- 411
- 4
- 15
13
votes
1 answer
How to rebase branch against master after parent is squashed and committed?
I use an optimistic work-flow in Gitlab, which assumes the majority of my merge requests will be accepted without change. The flow looks like this:
Submit a merge request for branch cool-feature-A
Create a new branch, based on cool-feature-A,…

Duncan Jones
- 67,400
- 29
- 193
- 254
12
votes
4 answers
Any gui for git merge (w squash)?
My work flow:
branch from master
work in my branch, commit frequently (100+)
when the job is done in my branch, merge master into my branch, resolve all the conflict.
CODE REVIEW TIME before merging back to master
For CODE REVIEW, I need to show…

Tom Fishman
- 1,716
- 6
- 22
- 36