相关疑难解决方法(0)

如何将新的本地分支推送到远程Git存储库并跟踪它?

我希望能够做到以下几点:

  1. 基于其他(远程或本地)分支(通过git branchgit checkout -b)创建本地分支

  2. 将本地分支推送到远程存储库(发布),但使其可跟踪,git pullgit push立即工作.

我怎么做?

--set-upstream在Git 1.7中知道,但这是一个创作后的动作.我想找到一种方法,在将分支推送到远程存储库时进行类似的更改.

git repository git-push git-remote git-branch

4154
推荐指数
16
解决办法
323万
查看次数

为什么我需要一直做`--set-upstream`?

我在Git中创建了一个新分支:

git branch my_branch
Run Code Online (Sandbox Code Playgroud)

推它:

git push origin my_branch
Run Code Online (Sandbox Code Playgroud)

现在说有人在服务器上做了一些更改,我想从中拉出来origin/my_branch.我做:

git pull
Run Code Online (Sandbox Code Playgroud)

但我得到:

You asked me to pull without telling me which branch you
want to merge with, and 'branch.my_branch.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like …
Run Code Online (Sandbox Code Playgroud)

git git-branch

1364
推荐指数
18
解决办法
93万
查看次数

没有指定分支的"git push"的默认行为

我使用以下命令推送到我的远程分支:

git push origin sandbox
Run Code Online (Sandbox Code Playgroud)

如果我说

git push origin
Run Code Online (Sandbox Code Playgroud)

这会推动我的其他分支的变化,还是只更新我当前的分支?我有三个分支:master,productionsandbox.

git push文件是不是这个很清楚,所以我想澄清这一点为好.

哪些分支和遥控器可以git push完全更新以下命令?

git push 
git push origin
Run Code Online (Sandbox Code Playgroud)

origin 上面是一个遥控器.

据我所知,git push [remote] [branch]只会将该分支推送到远程.

git branch git-push git-branch

1339
推荐指数
10
解决办法
62万
查看次数

标签 统计

git ×3

git-branch ×3

git-push ×2

branch ×1

git-remote ×1

repository ×1