user291701
user291701

Reputation: 39731

Push or pull from one repo to another?

I have a dev branch called "dev". I'd like to move all the changes from "dev" to "master".

I'm currently on the "dev" branch, can I just do:

git push origin master

and that'll send all my changes up to "master"? Or must I switch to "master" first, then run:

git pull --rebase origin dev

I guess it's just a push vs pull question, and which way git wants us to do that?

Thank you

Upvotes: 1

Views: 487

Answers (3)

vpatil
vpatil

Reputation: 3486

git checkout master, git merge dev, git push origin master will do. But as you have mentioned rebase, you might have to confirm you really want to use rebase or merge.

Upvotes: 0

manojlds
manojlds

Reputation: 301607

If you want to push dev on local to master on remote, you can do:

git push origin dev:master

The normal workflow is to merge dev into master and push master.

Upvotes: 1

jkj
jkj

Reputation: 2611

Merge you changes first (locally).

git checkout master     # change to "master"
git merge dev           # merge changes from "dev"
git push origin master  # push the new "master" as is

Upvotes: 1

Related Questions