0 votes
1 view
in Devops and Agile by (29.1k 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 (49.6k points)

Reference: https://git-scm.com/docs/git-pull#Documentation/git-pull.txt---rebasefalsetruemergespreserveinteractive

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

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...