Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
717 views
in Technique[技术] by (71.8m points)

git - How to get changes from another branch

I am currently working on featurex branch. Our master branch is named branch our-team. Since I started working on featurex, more changes have been made to branch our-team. Before I push featurex for merging, I would locally like to get all changes from our-team branch into featurex so that I can ensure everything works as expected.

I have done this locally to get all the latest changes from our-team.

git checkout our-team
git pull

How can I do that?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Before following these instructions keep in mind that featurex is the branch where changes are being merged and pushed

  1. go to the master branch our-team
  • git checkout our-team
  1. pull all the new changes from our-team branch
  • git pull
  1. go to your branch featurex
  • git checkout featurex
  1. merge the changes of our-team branch into featurex branch
  • git merge our-team
  • or git cherry-pick {commit-hash} if you want to merge specific commits
  1. push your changes with the changes of our-team branch
  • git push

Note: probably you will have to fix conflicts after merging our-team branch into featurex branch before pushing


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...