Term used in version control systems that means combining several commits into one. Most often seen with git.
Questions tagged [squash]
286 questions
3
votes
1 answer
Non-interactive fixup until specified hash
Let’s say I have hour commits
* 7bd4815 (HEAD) four
* afe9410 third
* db064dd second
* 46ab932 first
There are no uncommitted changes. What I want to do is non-interactively squash everything after first, into it. I want the equivalent of
pick…

user137369
- 5,219
- 5
- 31
- 54
3
votes
1 answer
Merging several commits into one in Git
I have a single branch git repository, that has ~4000 commits. I want to group the commits according to dates they were created. For example, given the commits below:
abcd 2013-4-1 12:10
abce 2013-4-1 13:27
...
cdef 2013-4-1 18:16
cdeg 2013-4-2…

altunyurt
- 2,821
- 3
- 38
- 53
3
votes
1 answer
Squashing first and third commits (leaving second unsquashed)
Suppose I have the following history in my repo:
git log --oneline
<3rd sha1> Third commit.
<2nd sha1> Second commit.
<1st sha1> First commit.
How do I squash the third commit to the first one leaving the second untouched?

talles
- 14,356
- 8
- 45
- 58
3
votes
1 answer
How do I get git branch history to match master after a squash rebase?
Let's say I have the following tree structure:
A-B-C-D
|\E-F (branch one)
\G-H (branch two)
Master history: A-B-C-D
Branch one history: A-B-C-E-F
Branch two history: A-B-C-G-H
I want to squash commit B, so the respective histories should…

melder
- 463
- 2
- 5
- 9
3
votes
1 answer
Git - Problems with Interactive Rebase and Squashing
I know there are lots of questions on SO about this, but I can't seem to find the answer I'm looking for at all.
I just merged my task branch into my master, and I am ready to push my changes to the remote master branch. However, they are…

Tim
- 8,932
- 4
- 43
- 64
3
votes
3 answers
git merge: is there a way to force --squash?
So, the dev workflow for our project is like this: we create a task/bug ticket, and we branch off master to work on the task/bug, and eventually merge it back to master. We would like the commits on master to have nice messages. People committing on…

EnToutCas
- 1,297
- 2
- 15
- 20
2
votes
1 answer
Partial squash-merge
I'd like to merge my feature-branch into my develop-branch, but squash some commits into 1, while pulling in others as-is.
Is there a possibilty to git merge --squash feature and then to choose which commits from the feature-branch should be…

quaylar
- 2,617
- 1
- 17
- 31
2
votes
2 answers
Squashing multiple commits that contain merge with main commits
Suppose we have the following scenario:
main branch
feature branch for new improvements
In the feature branch the commit history looks like this (main branch updates during the development process of feature branch and we want to keep feature…

Stefan Ss
- 45
- 5
2
votes
1 answer
Gitflow, Squash merged and AzDO branch compare
We are currently using Git flow as a branching strategy, and we are squashing our feature branches into develop. We are also squashing our release branches into main.
The AzDO branches page show differences in commits between develop -> main, which…

George Hastings
- 35
- 5
2
votes
1 answer
How can I create a sibling branch that includes all the commits from another branch into one node?
I have a branch, mybranch, that has six commits and stems from commit C. I would like to create a new branch, also based on commit C, that effectively includes all the commits from mybranch, squashed into one commit. What's the easiest way to do…

Phillip
- 5,366
- 10
- 43
- 62
2
votes
2 answers
Git -i rebase : Unknown command: squash
At the current point my git-rebase-todo is
squash: f732993 aaatest
# Rebase f3a7aa7..f732993 onto f3a7aa7
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s,…

Eugene
- 4,197
- 7
- 37
- 54
2
votes
1 answer
Showing the "squashed diff" of multiple commits
I'm looking for a shell script which displays the total/squashed diff of selected commits ($SELECTED_COMMITS) belonging to the same branch.
Background: My team is working on a rather long-living feature branch containing hundreds of commits related…

balu
- 3,500
- 4
- 34
- 35
2
votes
1 answer
GIT: can I maintain a ongoing development branch while squash-merging to master?
this seems like it should be a simple question to find the answer for, but I've been searching and pulling my hair out all morning and I just cant find an answer that satisfies me. The closest thing I've been able to find is this question, Git merge…

Brian H
- 323
- 2
- 8
2
votes
2 answers
Git interactive rebase squash commits - any shortcuts
I use git rebase -i HEAD~5 quite a lot to rebase my commits and squash them down into one. Question I have is, is there a shorthand way of doing this but saying to pick/rename the first commit and then squash all the rest? If I have 5 commits for…

JS_Dev
- 427
- 4
- 14
2
votes
2 answers
git automatically squash commits to previous commits that changed the same file/s
I have a feature branch with interleaved series of commits involving different files. I'd like to squash the commits together that involved the same files, but not squash together series of commits that don't touch each other. I don't want to have…

Lucas Walter
- 942
- 3
- 10
- 23