Reputation: 2536
I've two simple branches named master and admin. History is shown below.
I simply want to take admin branch's updates to master without merge commits. Then I have two options. Which of the following should I need to follow?
1.Checkout to admin and git rebase master
and fast-forward merge admin into master
2.Checkout to master and git rebase admin
I found some other findings too (that may be a reason to choose a solution)
So I think this is the main reason why we need to choose option 1, since we should not change the master's commits.
Upvotes: 0
Views: 145
Reputation: 129546
either way will work, but master branch is usually what others are working against as well if you are working with others. So from the admin branch, rebase it onto master:
git rebase master
Upvotes: 1
Reputation: 265201
The resulting history (oldest commit on top) for both cases:
Checkout to admin and git rebase master and fast-forward merge admin into master
added index file
updated index
admin added
admin updated
Checkout to master and git rebase admin
added index file
admin added
admin updated
updated index
So, I think you want to use option 1
Upvotes: 0
Reputation: 4150
You want to do option 1. that will apply everything new that's in admin
on top of the current state of master
Upvotes: 1