Reputation: 31272
Here is my work-flow in git at work: please correct if you find anything bad or if my understanding is incorrect;
I run
git branch -vv
dev 0ac3415 [origin/dev: behind 29]
master 8d9d84f [origin/master: behind 109] -- Merge branch 'dev'
XXX_dev ad3a2df [origin/XXX_dev: ahead 4] Merge branch 'XXX_dev' of my.company.com:AAA_BBB_CCC into XXX_dev
XXX_master 8c55372 [origin/XXX_master] Merge branch 'master' of my.company.com:AAA_BBB_CCC
Here is my understanding:
1) I have four branches in my local which are dev, master,XXX_dev and XXX_master. Each of these branches track remote branches with same name
2) I am in XXX_dev branch. If I have local commits in XXX_dev and do a git push
,
all the changes from XXX_dev in local will be merged into remote branch XXX_dev. Similarly when I issue git pull
, any changes from origin/XXX_dev ONLY will be pulled and merged into my local XXX_dev. Is this correct? or issuing git pull
does a git fetch and merge for all branches ?
3) Our development statergy is all changes are in XXX_dev
which will get pushed into origin/XXX_dev
. After QA team approves that origin/XXX_dev
build is stable, I will do a merge into origin/XXX_master
.
so how would I do this merge? I.e from one remote repository into another.
I am thinking something along this line..
git push origin/XXX_dev origin/XXX_master
-- but not sure if this is the right way to do it?
Any help is much appreciated. Thank you and a happy new year :)
Upvotes: 0
Views: 549
Reputation: 198496
do a
git push
, all the changes from XXX_dev in local will be merged into remote branch XXX_dev.
You can't merge with push, since you can't resolve conflicts. Push requires there not to be any changes on the remote branch; so push merely uploads the "missing" commits.
Is this correct? or issuing
git pull
does a git fetch and merge for all branches ?
It fetches everything, and merges the current branch. It is impossible to merge all the branches; again, how would you resolve conflicts?
so how would I do this merge?
Why does it have to be remote? If the branches are tracked, just merge XXX_dev
to XXX_master
and push.
Upvotes: 3