2

I'm developing a new feature, so I create a new branch, like this:

A--B--C--D              master branch
         \
          \-1--2--3     my feature branch

But given people is keeping adding code to master branch, I want to always to get latest code of master branch. Note, my feature is in a stand along directory, so there will be no conflict when rebase or merge to master. What I want is:

A--B--C--D--E--F
               \
                \-1--2--3--4

What git command should I use? Note that, I have pushed my feature branch to remote repository.

1 Answer 1

5

You can use the command

git pull --rebase

Since you need to rebase on top of master (instead of origin/feature), you can also break that into:

git fetch
git rebase origin/master

(assuming your current branch is your feature branch)

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

1 Comment

$ git pull --rebase You asked me to pull without telling me which branch you want to rebase against, and 'branch.ntfdev.merge' in your configuration file does not tell me, either. Please specify which branch you want to use on the command line and try again (e.g. 'git pull <repository> <refspec>'). If you often rebase against the same branch, you may want to use something like the following in your configuration file: [branch "ntfdev"] remote = <nickname> merge = <remote-ref> rebase = true [remote "<nickname>"] url = <url> fetch = <refspec>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.