Questions tagged [squash]

Term used in version control systems that means combining several commits into one. Most often seen with git.

See Git - Tools - Rewriting History: squashing.

253 questions
4121
votes
38 answers

Squash my last X commits together using Git

How can I squash my last X commits together into one commit using Git?
markdorison
  • 115,110
  • 27
  • 52
  • 69
649
votes
8 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
  • 11,184
  • 6
  • 40
  • 67
600
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
  • 71,135
  • 44
  • 128
  • 148
550
votes
19 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
  • 23,861
  • 32
  • 81
  • 109
435
votes
4 answers

What is the difference between merge --squash and rebase?

I'm new to git and I'm trying to understand the difference between a squash and a rebase. As I understand it you perform a squash when doing a rebase.
GiH
  • 11,696
  • 13
  • 40
  • 53
168
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
  • 83,104
  • 64
  • 169
  • 214
131
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
  • 4,640
  • 9
  • 37
  • 59
122
votes
6 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
  • 3,699
  • 6
  • 26
  • 34
87
votes
3 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,320
  • 13
  • 18
69
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
  • 21,611
  • 21
  • 111
  • 204
67
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
  • 3,535
  • 5
  • 33
  • 56
64
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
  • 4,686
  • 7
  • 20
  • 35
62
votes
1 answer

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,489
  • 1
  • 14
  • 28
58
votes
4 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,647
  • 4
  • 33
  • 43
38
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
  • 26,451
  • 11
  • 86
  • 123
1
2 3
16 17