-1

I have one local dev branch coming from the origin master. I created a feature branch off of the local dev.

Did some work and pushed the feature up-stream back to origin. It now appears on the server branches.

However, now dev has had changes by other developers... so I did a git pull to my local dev branch, which is now sync-ed up to the server.

Now I need to get those changes into my feature from the local dev before I push feature back up to the origin server. (OR do I directly merge/pull/whatever from server dev into the feature).

Obviously Im confused.
Thanks in advance for you help/clarification.

Yogi Bear
  • 943
  • 2
  • 16
  • 32

1 Answers1

0

If the idea is to update your feature branch to catch up with the current state of dev, then pull dev (you did that), switch to feature, and merge dev into feature.

Alternatively, if you have not pushed feature yet, you can pull dev (you did that), switch to feature, and rebase feature onto dev.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • I'll add that if you have pushed feature but nobody else has done work on it, you can rebase it. We do that since feature branches are almost never shared between devs. As always ask ask ask to make sure. – siride Feb 11 '22 at 14:16
  • Or fetch dev and then merge origin/dev straight into feature. No need to create a local version of dev. – jessehouwing Feb 11 '22 at 14:17
  • @jessehouwing Of course I totally agree. The problem is that the OP seems to _already_ have a local `dev`. Otherwise my advice would have been quite differently expressed. – matt Feb 11 '22 at 14:23
  • Maybe better to add a section on, now that you're here as well as a in the future / next time... – jessehouwing Feb 11 '22 at 14:32
  • @jessehouwing This is how I teach: I start with where the student actually is. In this case I accept the premise "I created a feature branch off of the local dev" and go from there. Local branches are good for beginners so I see no need to press the matter further. – matt Feb 11 '22 at 14:53