I have a branch with around 10 commits. 3 of these are merge commits merging master to my branch and adding ~500 commits in between each time. Is there a way to squash commits that were made on the current branch in one? my history looks something like this:
ad54ef86 My Commit 1
ad54ef86 Merge commit
ad54ef86 Others' Commits
....500 more others' commits
ad54ef86 My Commit 2
ad54ef86 My Commit 3
ad54ef86 Merge commit
ad54ef86 Others' Commits
....500 more others' commits
ad54ef86 My Commit 4
...
Now doing git rebase -i HEAD~2000
and searching is a lot of work. It there a way around it?
EDIT: So this question is being tagged as a duplicate of Squashing last n commits together. That is clearly not my problem. I want to squash the last n commits made ONLY on my current branch AFTER I merge another branch in this branch and get all those commits in the way as well.
First, I would ask what is the purpose of your rebase? Do you want to eventually push your commits to the remote? Or, do you want to simply have your commits on top and just continue to work locally? Either way, I suggest you take the following steps:
Remember to do fetch and rebase next time you need to synchronize to the remote.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With