我希望能够做到以下几点:
基于其他(远程或本地)分支(通过git branch或git checkout -b)创建本地分支
将本地分支推送到远程存储库(发布),但使其可跟踪,git pull并git push立即工作.
我怎么做?
我--set-upstream在Git 1.7中知道,但这是一个创作后的动作.我想找到一种方法,在将分支推送到远程存储库时进行类似的更改.
我在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 push origin sandbox
Run Code Online (Sandbox Code Playgroud)
如果我说
git push origin
Run Code Online (Sandbox Code Playgroud)
这会推动我的其他分支的变化,还是只更新我当前的分支?我有三个分支:master,production和sandbox.
该git push文件是不是这个很清楚,所以我想澄清这一点为好.
哪些分支和遥控器可以git push完全更新以下命令?
git push
git push origin
Run Code Online (Sandbox Code Playgroud)
origin 上面是一个遥控器.
据我所知,git push [remote] [branch]只会将该分支推送到远程.