Linked Questions

512 votes
8 answers
394k 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, ...
muudscope's user avatar
  • 6,980
101 votes
4 answers
154k views

Squash all my commits into one for GitHub pull request [duplicate]

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 ...
omerjerk's user avatar
  • 4,159
63 votes
1 answer
58k views

Git: simplest way of squashing commits on master [duplicate]

Possible Duplicate: How can I squash my last X commits together using git? I have a project hosted on GitHub and I have a local clone. I have a load of small commits that I have already pushed up ...
Gabe's user avatar
  • 1,118
41 votes
2 answers
17k views

Git merge commits [duplicate]

I'm new to git (and enjoying it a lot!). While developing in a new branch, I kept committing the various development 'states' of my application. Now I have to check it in for review but didn't want ...
DiogoNeves's user avatar
  • 1,747
2 votes
1 answer
3k views

Squash 2 commits into 1 [duplicate]

I have two commits locally: commit adae40c5e2b69a41447b08cc3dcb77003611fbbe Author: Me Date: Thu Mar 21 14:17:35 2019 +0000 1.0.0 commit ceaa65ea06f48dc24554a6f798aae2d668f3a43d Author: Me ...
runnerpaul's user avatar
  • 6,698
2 votes
2 answers
2k views

Is it possible to easily move all commits from one branch onto another as one commit? [duplicate]

I know, I can do an interactive rebase, reword first commit and fixup all other. But if a branch contains hundreds of commits it becomes very tedious. Is there a simpler way?
Victor Dombrovsky's user avatar
-1 votes
1 answer
1k views

How to squash the last N commits into a single commit in git? [duplicate]

I actually want to squash around 5-6 commits in a single commit. What is the best option I have in this case?
Muhammad Mujtaba Shafique's user avatar
2 votes
0 answers
2k views

git squash last n commits without interactive rebase [duplicate]

I do a lot of squashing where I only care about the commit message of the first commit. currently I use the well-known git rebase -i head~n, which makes this time-wasting multi-step processes. I've ...
Martin Klosi's user avatar
  • 3,228
0 votes
1 answer
1k views

Git commit shows over 100 commits after merge [duplicate]

When I merged my branch A to branch B and was ready to commit and push, my console told me that there were 101 commits that I will be pushing. Question is, how can I remove all these commits into just ...
Robin's user avatar
  • 605
0 votes
1 answer
453 views

How to squash multiple commits in history into one? [duplicate]

I have a branch "master" which has 5 commits: A --> B --> C --> D --> E (master) Now I want to merge the intermediate commits B, C, and D into one because their changes are ...
Mojie11's user avatar
  • 95
0 votes
3 answers
275 views

How to squash your commits when not being your recent ones [duplicate]

It seemed easy to squash your commits if these are your recent ones (Squash my last X commits together using Git) But what if I want to squash a few commits of my repo that are not the recent ones, ...
vaskort's user avatar
  • 2,741
-2 votes
1 answer
621 views

How to git reset all commits of a branch without losing changes? [duplicate]

I have a bunch of commits in a branch. I would like to recommit them today starting from a fresh branch rather than having my old commits. How can I do that, comparing with master? I couldn't find a ...
alien's user avatar
  • 839
-1 votes
1 answer
361 views

How to remove commits by a foreign contributor when squashing commits? [duplicate]

I want to squash the last 25 commits into one commit, so I did this: git reset --soft HEAD~25 git commit -m "main refactor" I have squashed the commits and added to one commit but I wanted it to ...
valen ezu's user avatar
  • 113
1 vote
0 answers
419 views

Git range for rebase [duplicate]

I have a tree like the below in my git log. I want to take those first 10 commits and squash them into one. So I ran git rebase -i HEAD~10 That's a pain to count out and see that's 10 entries ...
Gargoyle's user avatar
  • 10k
0 votes
2 answers
226 views

Deleting a git commit but preserve change [duplicate]

I have commits like this, 1 is the newest, and three is the oldest: commit 1 commit 2 commit 3 How to remove commit 1 and 2, but preserves the changes and commit it to the commit 3?
adnntfr's user avatar
  • 102

15 30 50 per page
1
2 3 4 5
12