How to get the latest changes from master to a branch

kchintala November 4, 2014

I've created a branch(say: branch1) from master. Recently I've modified the code in `branch1` and commited the code and a new pull request is requested.

Now that i've created another branch(say: branch2). I'm working on one of the issues. Today I've received an email that my branch1 is merged into master. I've got the latest changes to master by pulling the new changes. Now the master has HEAD revision.

As master has the latest code now, how do I get the changes to `branch2` from `master` ?

It would be great if you can help me on this.

 

Karthik

1 answer

1 accepted

3 votes
Answer accepted
Marcin
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 4, 2014

Assuming you are already on branch2 (you can check with git branch), you can just git merge master to merge the local master branch into your current branch.

If you hadn't already pulled master you could also do from your branch:

git fetch origin # fetches changes from origin but does NOT apply them
git merge origin/master # merges master as it exists on origin into your branch

Note that this approach would not update your local master branch though until you switched to it and did a git pull.

Have a look at the Atlassian git Tutorials section on Branching and Merging for a more thorough explanation.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events