git:如何在不签出的情况下进行推送? [英] git: how to push without checking out?
问题描述
我有两台计算机A和B,并使用git sync一些文件,例如init.el.
A的回购存放在未附带通知的主机上. B的仓库是本地的.
- A中的init.el被修改并推送. B中的
- init.el也被修改.
问题是:如何将A的更改合并到B中,并将最终的init.el推入非混淆(A),而不会在B中扩展A的所有文件
还是有更好的解决方案?
谢谢.
因此,如果您不想提取在A
处修改过的文件,则可以这样做:
在B
处,创建一个新分支并将其推送到远程服务(如您所说,解除捆绑):
cd path/to/init.el
git branch featureModifiedInB
git checkout featureModifiedInB
git push origin featureModifiedInB
在A
,提取在B
创建的分支的更新,管理合并&冲突:
cd path/to/init.el
git pull origin featureModifiedInB // Or you can do fetch and manually do merging.
git checkout master
git merge featureModifiedInB
// After solve the conflict if it exists.
git push origin master
确保使用B
的人员看不到使用A
的人员编辑的文件.但这会引起问题:pB无法获得有关他/他创建的代码的反馈.但是pA还可以修改featureModifiedInB
分支,并让它由pB拉(妈妈,这有点麻烦.).
I have two computers A and B, and use git sync some files, init.el for example.
A's repos is hosted on unfuddle. B's repos is locally.
- init.el in A is modified and pushed.
- init.el in B is modified, too.
The question is: how to merge A's changes into B's and push the final init.el into unfuddle (A), without expanding A's all file in B.
Or there is a better solution?
Thanks.
So, if you do not want to pull the files that modified at A
, you can do like this:
At B
, create a new branch and push it to remote service(unfuddle, as you said):
cd path/to/init.el
git branch featureModifiedInB
git checkout featureModifiedInB
git push origin featureModifiedInB
At A
, pull the update of branch that created at B
, manage the merge & conflict:
cd path/to/init.el
git pull origin featureModifiedInB // Or you can do fetch and manually do merging.
git checkout master
git merge featureModifiedInB
// After solve the conflict if it exists.
git push origin master
It makes sure that person using B
can not see the files that edited by person who uses A
. But this'll cause a problem: pB cannot get feedback about the code s/he created. But pA can also modify the featureModifiedInB
branch and let it pulled by pB(mum..it's a little bit troublesome..).
这篇关于git:如何在不签出的情况下进行推送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!