Git 将本地 master 推送到远程特定分支

Git push local master to remote specific branch

我在我的本地分支中进行了更改。然后我结帐到我的主分支并将其与我的本地分支合并。现在我想将 master 分支中的更改推送到远程的特定分支。比如说,我们有 5 个开发人员。每个人在远程仓库都有自己的分支。如果我在本地仓库中修改了某些内容,我应该将我的工作推送到以我的名字命名的分支上。

How can I push that changes from my local repo master to my branch at remote repo?

一旦我将它推送到我的远程仓库分支,我就会将我的更新通知我的其他团队成员。

How can they fetch and merge my updation located in my remote branch to their local master?

您可以在 git push 命令中指定远程分支名称,如下所示:

git push <remote> <local branch name>:<remote branch name>

所以在你的情况下,是这样的:

git push origin master:smith-master

如果你想让它成为推送的默认分支,请另外使用 -u 标志。

要从本地 master 推送到不同的远程 branch,请使用:

git push origin master:branch

要让您的朋友将此遥控器 branch 拉入他们的本地 master,他们可以使用 git pull 作为:

git checkout master
git pull origin branch