JohnCarp JohnCarp - 3 months ago 8
Git Question

How to get updated GitHub project after merge?

I have a quick question about GitHub (workflow). I just started using it so this question might seem naive.

1) Say I have a local project which I created a branch and committed my changes.

2) I push up my changes to my GitHub Repository.

3) I then create a Pull request to a member who is going to review my work.

4) He accepts the work and merges my branch with his master copy.

My question is, how do I get those changes to my project? I am confused on how to update my project by using his since he merged it to his master branch?

Answer

Okay. So let's say you worked on a feature and your branch is called "1420" after your colleague accepted your work and merged with master

He should push master branch to server, and then you have to branch out from master to begin with a new feature.

Steps:

  1. Checkout to master branch.

    git checkout master
    
  2. Make sure your local master branch have the latest changes from server by pulling all the changes.

    git pull
    

(by now you have all your changes)


Additional steps to start a new feature:

  1. Create a new branch from master for the new feature which will consist of your old branch 1420 commits and master commits (make sure you are in master branch) and then.

    git checkout -b 1421
    
  2. By now you should have all your changes and you are good to go