Questions tagged [git-squash]
git squash is the command used to rewrite git history before it is pushed to the remote.
git-squash
225
questions
5512
votes
46
answers
4.0m
views
How do I squash my last N commits together?
How do I squash my last N commits together into one commit?
1893
votes
15
answers
1.1m
views
How can I merge multiple commits onto another branch as a single squashed commit?
I have a remote Git server, here is the scenario which I want to perform:
For each bug/feature I create a different Git branch
I keep on committing my code in that Git branch with un-official Git ...
512
votes
8
answers
395k
views
Combining multiple commits before pushing in Git [duplicate]
I have a bunch of commits on my local repository which are thematically similar. I'd like to combine them into a single commit before pushing up to a remote. How do I do it? I think rebase does this, ...
183
votes
8
answers
151k
views
How to squash commits which have merge-commit in between?
I am working on a feature branch.
Made several commits. Squashed commits.
Pushed changes to remote branch. Got conflicts.
Merged changes from master, resolved conflicts on feature branch.
git fetch ...
182
votes
8
answers
109k
views
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 ...
133
votes
5
answers
73k
views
Cherry-pick and squash a range of commits into a subdirectory or subtree
How can I tell cherry-pick to pick range of commits and squash it?
Or in other words, apply the diff between two commits to the current state of the repository?
The following does not work (cherry-...
77
votes
6
answers
12k
views
How can I delete all git branches which have been "Squash and Merge" via GitHub?
Ever since GitHub introduced Squash and Merge, all the cool kids at my workplace are using it when merging pull requests. Is there a way to cleanup "Squash and Merge" branches?
The following command ...
65
votes
4
answers
32k
views
Gitflow: Should I squash commits when merging from a release branch into master?
I am going to merge my release branch to master and I am wondering if I should squash the commits from develop into a single merge commit when merging into master.
General documentations about git ...
58
votes
3
answers
42k
views
Git rebase (Merge Squash) my feature branch onto another branch
I'm looking for a git command to help me with my feature branches when they're ready to go into Master. This git command would squash all my changes on my branch into a single commit on top of master. ...
55
votes
2
answers
36k
views
git merge squash and recurring conflicts
I have a git repository with master and alt branches. alt branch contains modified version of master code, and i am trying to merge changes from master to alt like this:
git merge --squash master
...
54
votes
1
answer
20k
views
Git squash commits in the middle of a branch
I want to squash several commits together in the middle of a branch without modifying the commits before and after.
I have :
A -- B -- C -- D -- E -- F -- G
| |
master ...
29
votes
3
answers
8k
views
What happens to tags of squashed commits?
If I have commit A tagged with tag e.g. tag-A, and then the next commit B tagged with tag-B; if I squash these 2 commits what happens to the tags? Will both be assigned to the squashed commit?
28
votes
8
answers
16k
views
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 (...
28
votes
4
answers
22k
views
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 -...
24
votes
3
answers
10k
views
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.