简体   繁体   中英

How do I take the latest from another branch and then do a commit

Pardon me as I am a newbie to git. I understand SVN and if someone can explain it in terms of SVN, that will be great. Currently, I am using the tool GitHub for Mac. But, I am open to using the terminal.

I am working locally on a master branch. A colleague has made changes in another branch. Before I checkin my changes, I want to merge that branch into my local master branch and then commit. How do I go about it?

Assuming your colleague has pushed his changes to the central repository, you could do this

git fetch

Git fetch will get your colleagues changes to your local repository.

Let's say the branch he worked on was called other_branch , then you can do this to merge his changes to your current branch:

git merge origin/other_branch

When you are done merging you can push your changes to the central repository:

git push

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