简体   繁体   English

Git,单独的分支从中拉出并推入

[英]Git, separate branches to pull from and push to

My repository is set up in a way that when someone pushes on "branches", a CI system checks what has been pushed and then pushes back on "master". 我的存储库的设置方式是,当有人按下“分支”时,CI系统会检查已按下的内容,然后再按下“主”。 So, when someone pushes and pulls, it's on "branches". 因此,当有人推拉时,它就在“分支”上。 But if someone commits and push something wrong, it stays on "branches", and when someone else pulls, it drags in the bad things. 但是,如果有人犯错并推错了东西,它就会停留在“分支”上,而当其他人拉扯时,它就会把不好的事情拖进去。

I found that I can change "git pull" and "git push" commands so that they pull/push from another branches than Master, but can I separate these two settings? 我发现可以更改“ git pull”和“ git push”命令,以便它们从Master以外的其他分支中进行拉/推,但是我可以分开这两个设置吗? How can I set my repository in a way that "git pull" = "git pull origin master" and "git push" = "git push origin branches" 如何设置“ git pull” =“ git pull origin master”和“ git push” =“ git push origin branchs”的方式

Thanks in advance 提前致谢

I think you would be better off respecting the way Git works. 我认为您最好尊重Git的工作方式。

You can have your users explicitly pull from master and push to branches. 您可以让您的用户明确地从master分支拉入分支。

This way your history will make more sense in the long run no user will be confused by the hidden logic. 这样一来,从长远来看,您的历史记录将变得更加有意义,没有用户会被隐藏的逻辑所迷惑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM