Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update a branch with master on GitHub

I have a Sprint branch that was created prior to new updates on Master. Since then, the changes were pushed to the master branch, now I have to update the Sprint branch. I am trying to sync my Sprint branch with a master.

Is there a way to do it through github.com page, otherwise I am using PhpStorm VCS.

like image 802
bisamov Avatar asked Jan 26 '20 06:01

bisamov


People also ask

How do I sync my branch with GitHub master?

In GitHub Desktop, click Current Branch. Click Choose a branch to merge into BRANCH. Click the branch you want to merge into the current branch, then click Merge BRANCH into BRANCH. Note: If there are merge conflicts, GitHub Desktop will warn you above the Merge BRANCH into BRANCH button.

How do I update my latest master from GitHub?

tl;dr: run git fetch to fetch latest changes, then run git rebase master to update your branch to the latest changes in master.


1 Answers

It's simple and can be done by two command lines:

git checkout sprint
git merge origin/master

This will merge the remote master branch to the local sprint branch. So your local sprint branch is up to date like the master branch.

If you need to do this on Github.com, then create a PR(Pull Request) and then select two branches(base:sprint and compare:master) and then merge it.

Github pull request with base: sprint, compare: master

like image 191
CrazyDev Avatar answered Nov 19 '22 17:11

CrazyDev