git - 如何在gitlab中创建和提交分支

标签 git ubuntu-14.04

这是我为了其他人的利益而回答的问题。但是,如果有人在我完成研究之前回答这个问题,我将不胜感激。

我如何从 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/

相关文章:

git - 如何从需要 SSL 证书的 docker 文件运行 git clone

git - 如何将 Git 中的文件添加到以前的子模块的路径中?

python-3.x - 在我的 ubuntu 服务器上以管理员身份运行 conda install,我得到 "Missing write permissions:/home/ubuntu/anaconda3"

ubuntu 服务器 14.04 64 位操作系统上的 couchdb 1.5.1 进程错误

git - 加载我的私钥以用于 Mac 上的 git

git - 在 git 控制下获取 node_modules 中的 npm 模块

git:在 rebase 后删除死分支?

c++ - Ubuntu 16.04 LTS 和 Oracle Instant Client - C++ 链接错误

python - 类型错误 : parse() got an unexpected keyword argument 'override_encoding'

apache - 在 ec2 亚马逊实例上的 ubuntu 服务器上安装了灯,仍然无法通过运行 apache 的浏览器访问服务器。为什么?