Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

I have cloned a project from a master branch from remote repository remote_repo. I create a new branch and I commit to that branch. Other programmers pushed to remote_repo to the master branch. I need now to rebase my branch RB onto remote_repo master. How to do this? What commands to type to a terminal?

1 Answer

0 votes
by (50.2k points)


As the latest versions of git suggest us to solve this problem using 

git pull --rebase origin master

# where --rebase[=(false|true|merges|preserve|interactive)]

As the reference link has a full description about --rebase option.

In the previous version we use a different method in which you need to First fetch the new master from the upstream repository, then rebase your work branch on that:

git fetch origin            # Updates origin/master

git rebase origin/master    # Rebases current branch onto origin/master

Browse Categories