Wednesday, April 1, 2020

Git pull from master into the development branch

Suppose you are working in branch-name : "branch-1". And you team is working on Branch name : "branch-2".

Now you want to take latest code from branch-name : "branch-2" to your working branch (whrer you are currently working).

git command to switch branch:
git checkout <branch-name>
git checkout branch-1    ------------> Now you are in your working branch

git command to pull remote repository code:
git pull origin master

Where
"branch-1" is “working-branch” in which branch you are currently working

   git pull git pull https://github.com/javaiq/git-commands-test branch-2  

Where :-
Origin -> https://github.com/javaiq/git-commands-test   // this is the api url

master -> “branch-name” from where we want to pull code into “working branch”
  Note:-  Here master is "branch-2" 

In this case pull command will do fetch + merge code from remote branch.
fetch the code from remote "branch-2" and merge the code with "branch-1"




Related Tutorial

No comments:

Post a Comment