Reputation: 2058
I know this has been asked a lot, but I have not really seen a good answer. Here is what I am looking for.
We do pull-requests in Stash.
We want the history to show one commit per feature (stash merges into master, so there is one merge, one commit).
Work is done in feature branches, and commits happen often.
Git rebase master is used to rewrite the history to get one commit.
The issue I am facing is that when a few features go into master, I git merge my feature branch with master, and add a few more commits. When my code is ready for review I rebase and now git thinks there are conflicts.
What I want the history to really look like is the same as doing
$ git diff master > feature.patch
$ git checkout master
$ patch -p1 < feature.patch
$ git commit -am "[Bug-1234] Desc"
Is there any way to do this with rebase? Basically accept all as they are in HEAD.
EDIT:
Here are the commands that put me in this spot
(feature/awesome) $ git merge master #resolve conflicts
(feature/awesome) $ git rebase --interactive master
Upvotes: 0
Views: 1956
Reputation: 73580
What happens in the default rebase master
case is that all commits since the merge-base of master and your feature branch get replayed and some of those conflict with the squashed commits that have already been applied.
However if you know the last commit that was merged from your feature branch into master, then you can apply only the commits after LASTCOMMIT on your feature_branch.
git rebase --onto=master LASTCOMMIT feature_branch
Upvotes: 2