2

Let's say I have a feature branch derived from master. Master is ahead several commits. I want to include lastest updates from master into my feature branch.

What is the correct approach?

  1. git pull
  2. git pull --rebase
  3. git pull origin feature
  4. git pull origin master
  5. git rebase origin/master
  6. git merge origin/master
  7. Something else?

Sorry for lame question, but I really do have little bit of a mess in these commands. Description of the differences between the commands would be highly appreciated.

2
  • 2
    Does this answer your question? How to keep a branch synchronized/updated with master? Commented Jul 15, 2022 at 15:28
  • 1
    @evolutionxbox that specific question mentions that the branch in question is "a continuous branch", which would lean the best answer towards merge, whereas this question, specifying a feature branch without any additional context, would probably lean towards rebase. Since both are presented in the top answers to that other question, I'm not opposed to that being the dup, though, I assume there is probably a better dup match. Commented Jul 15, 2022 at 19:05

1 Answer 1

1

git rebase origin/master is the answer to your question.

Sign up to request clarification or add additional context in comments.

3 Comments

It's one of many correct answers. Also, if origin/master hasn't been updated (with fetch), this will do nothing
git rebase or git merge are possible answers but git rebase is clean and the best fit for this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.