RegisteredUser
RegisteredUser

Reputation: 410

how to sync two remote branches in git?

I just started using git, I am faced with a situation where I have two remote branches master and alpha.

Each branch has 268 packages.

Now I have to copy everything from branch master which had a lot of commits to branch alpha which was originally created from branch master.

could any one give me any ideas on how to achieve this?

Upvotes: 1

Views: 6798

Answers (1)

Wan B.
Wan B.

Reputation: 18835

First you check out alpha.

git checkout alpha

(do git pull if you are not up to date, or git status to check first)

Then:

If you are the only one that is working on the project, you can use rebase

git rebase origin/master

If there are other people working on the project, I would suggest to use merge.

git merge origin/master

Then, you can check your local repo whether everything is good. if it is. do a commit, then push back to your remote alpha.

Upvotes: 8

Related Questions