How can you reinstall current branch changes in addition to merges?

Good. If I am on a branch (say working ) and I want to merge the changes with another branch (for example, master ), then I run the git-merge master command while in the working branch, and the changes are merged without reinstalling the story at all. If I run git-rebase master , the changes to master will be reordered to be placed at the top of the working branch. But what if I want to merge the changes from master , but reinstall my changes to working to be at the top? How should I do it? It can be done?

I can run git-rebase working in my master branch to put my changes on top in the master branch, but I would like to be able to do this in my working branch, and I have no idea how. The closest I can come up with is to create a new branch from master and then reformat the working changes on top of it, but then I will have a new branch instead of changing the working branch.

+111
git git-rebase merge rebase
Sep 04 '11 at 4:14
source share
3 answers

You have what rebase does back. git rebase master does what you ask for - accepts the changes in the current branch (starting from its divergence from the master) and repeats them on top of master , and then sets the chapter of the current branch as the chapter for this new story. It does not replay changes from master on top of the current branch.

+213
Sep 04 '11 at 4:18
source share

Another way to take a look at this is to consider git rebase master as:

Restore current branch on top of master

Here ' master ' is a branch upstream , and this explains why during reinstallation ours and theirs are reversed .

+55
Nov 22
source share

I just did this a few minutes ago as follows:

  1. git checkout -b work-in-progress backup of the current work git checkout -b work-in-progress
  2. get the latest git fetch origin master changes
  3. undo all local changes git reset --hard origin/master
  4. replay recent changes from master git rebase origin/master
  5. reproduce your work in git rebase origin/work-in-progress
  6. sync your work with latest master git rebase origin/master
+6
Sep 13 '16 at 7:58
source share



All Articles