1

I am using gitlab and we are following gitflow methodology so we have one master branch and then dev branch we have taken from the master, we do not disturb master right now at all.

From dev we take future branches lets say future 1 and future 2 and now suppose some other developer is working on future 1 and I am working on future 2 branch.

Now in order to commit my changes of future branch 2 after doing internal testing back to the dev branch, I need to make sure that I am in sync with dev, the branch always, so I do the below process in a sequence of steps, please let me know are they in correct order or not.

  1. the current branch is future
  2. stash my changes switch to the dev
  3. branch git pull ( take the latest of dev)
  4. switch to future 2 branch
  5. git stash pop
  6. since I am using intellij idea so I go to VCS option in the menu
  7. vcs git branches --> dev ---> merge into current
  8. Resolve conflicts
  9. vcs git commit push

1 Answers1

0

You should not merge dev into your current branch.

You should rebase your future branch on top of origin/dev: that would replay your local commits on top of the updated remote tracking branch.

Which means a simple fetch (without stashing/switching branch) is enough: VCS | Git | Fetch.

With IntelliJ IDEA, see "Apply changes from one branch to another": Rebase Current onto Selected.

If you want to test it, create another branch, reset to a commit in your feature branch made before any merge of dev to feature.

Also, with Git 2.6+, set git config --global rebase.autoStash true: the stashing will be done for you.
IntelliJ has its own shelving option.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250