简体   繁体   中英

Git: Pulling and merging branch into Master

So far I have used Git individually and first time I am using as a team. I am facing an issue: There is a master repo which contains 2 branches; dev1 and dev2 . I have been assigned to review Code of dev1 and merge into master .

Now In order to view code or running it I want to set his branch on local machine. How do I pull all of his branch data very first time so that I could have his folders on machine and how later I could pull his changes from his branch.

Later how do I merge branch dev1 into master ?

Thanks

If you not already have a clone of the remote repo:

git clone <remote repo url from GitHub>
cd <repo>

Fetch all remote branches from remote repo:

git fetch origin

Checkout remote branch 'dev1':

git checkout dev1

Review and run the code as you see fit.

If you have privileges (on GitHub) to push to 'origin:master' you should be able to merge 'master' with 'dev1' and push the updated 'master':

git checkout master
git merge dev1
git push origin master

If you do not have privileges to update remote 'origin:master' you can issue a pull-request (on GitHub).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM