这是我为了其他人的利益而回答的问题。但是,如果有人在我完成研究之前回答这个问题,我将不胜感激。
我如何从 shell 分支一个现有的 git 存储库(我有开发人员访问权限)、编辑它、提交这些更改,然后将它推送到服务器以供审查,然后再 merge 。
编辑
请注意,这不是我的项目,而是其他人的。这种使用让我可以做一些工作。完成后,我会要求他们将更改 merge 回原始
最佳答案
要设置您的存储库,您需要遵循 these instructions .然后你需要克隆/fork 现有的 repo like this .
然后进行更改。完成更改后。您将需要做出如下所示的“提交”
git commit -m "I changed something somewhere"
然后您将想要从您工作时可能已推送的存储库中提取任何更改。
git pull origin master // master being the branch that you cloned/forked
一旦 pull 完成且没有冲突,您可以将您的更改向上推送。
git push origin master // this is saying that you want to replace the remote master branch with your local master branch
编辑 要在不覆盖 master 的情况下推送到 repo,请执行以下操作:
git clone //clone what branch you want
git checkout -b new_branch //this will create a new local branch
git push origin new_branch //this will create a new origin branch
关于git - 如何在gitlab中创建和提交分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32125514/