使用git推送到另一个分支

时间:2017-07-13 12:10:34

标签: git

我通过ssh完成了projet的克隆

git clone ssh ssh://git@10.7.5.11:IMER/ropolo.git

master分支受到保护,因此无法推动我的更改。

还有另一个分支dev_ropolo

我是否需要在本地使用此分支。 需要做些什么才能将我的更改推送到此分支?

修改

$ git fetch
* [new branch]      ropolo -> origin/ropolo

$ git branch
* master

3 个答案:

答案 0 :(得分:4)

您说您在本地克隆了存储库,然后可以通过以下方式访问分支dev_ropolo

git checkout dev_ropolo

您现在已选择dev_ropolo作为当前分支:执行本地更改,添加和提交,然后使用以下命令推送它们:

git push origin dev_ropolo

(假设遥控器设置为origin

答案 1 :(得分:3)

在本地仓库中使用fetch命令

$ git fetch

使用

检查您的分支机构是否已到达您当地
$ git branch

现在使用结帐更改您的分支

$ git checkout -b branch_name

然后进行一些更改

$ git add .
$ git commit -m "message"
$ git push origin remote_branch_name

答案 2 :(得分:1)

git push:

例如:git push origin branch1:branch2

相关问题