Do I need to merge a branch in a bare repo?

孤街醉人 提交于 2019-12-24 05:49:32

问题


In my setup I have three repos:

  1. A bare repo on remote server (/op/git/proj.git)
  2. A non-bare repo on remote server (/var/www/proj/.git)
  3. A non-bare repo on local machine (/var/www/proj/.git)

The bare repo is origin to both ordinary repos on local and remote.

Whenever I do a commit on local, I do a local push to bare repo and then pull on ordinary remote repo and I get my changes on remote.

Now, I want to merge branch A to master which method should I use? (Assume master is the current branch on both repos)

Method 1
1. local$ git merge A
2. local$ git push origin master
3. remote$ git pull origin master

Method 2
1. local$ git merge A
2. remote$ git merge A

I am not sure if the second method is all I need to do or not, in other words, since you cannot do things like checkout and merge in a bare repo, do you need to do anything to the bare repo after a merge?


回答1:


Use method 1.

Method 2 would only work if git merge A will be a fast-forward on both local and remote. If any of the git merge A operations result in a merge commit (not fast-forward), the master branches will have diverged.

In general, merging the same branch in multiple locations is rarely useful in practice.

do you need to do anything to the bare repo after a merge?

Just push to it, that's all.



来源:https://stackoverflow.com/questions/40321497/do-i-need-to-merge-a-branch-in-a-bare-repo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!