Git新建本地分支与远程分支关联问题:git branch --set-upstream
2016-08-29 18:33
591 查看
Git新建本地分支与远程分支关联问题:git branch --set-upstream
git在本地新建分支, push到remote服务器上之后,再次pull下来的时候,如果不做处理会报以下提示:
问题解析:
git本地新建一个分支后,必须要做远程分支关联。如果没有关联, git 会在下面的操作中提示你显示的添加关联。关联目的是如果在本地分支下操作: git pull, git push ,不需要指定在命令行指定远程的分支. 推送到远程分支后, 你只要没有显示指定, git pull 的时候,就会提示你。
解决方法:
使用命令git branch --set-upstream ;实例如下,其中debug为创建的分支
命令的最终修改都是针对 config 文件。
使用-- set-upstream 去跟踪远程分支。
注意仓库.git目录下的config文件
git在本地新建分支, push到remote服务器上之后,再次pull下来的时候,如果不做处理会报以下提示:
You asked me to pull without telling me which branch you want to merge with, and 'branch.production.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 the following in your configuration file: [branch "debug"] remote = <nickname> merge = <remote-ref> [remote "<nickname>"] url = <url> fetch = <refspec> See git-config(1) for details.
问题解析:
git本地新建一个分支后,必须要做远程分支关联。如果没有关联, git 会在下面的操作中提示你显示的添加关联。关联目的是如果在本地分支下操作: git pull, git push ,不需要指定在命令行指定远程的分支. 推送到远程分支后, 你只要没有显示指定, git pull 的时候,就会提示你。
解决方法:
使用命令git branch --set-upstream ;实例如下,其中debug为创建的分支
git branch --set-upstream debug origin/debug
命令的最终修改都是针对 config 文件。
使用-- set-upstream 去跟踪远程分支。
[core] repositoryformatversion = 0 filemode = true bare = true logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = git@192.168.1.160:android2.3.5_r1.git [branch "master"] remote = origin merge = refs/heads/master [branch "debug"] remote = origin merge = refs/heads/debug [receive] denyCurrentBranch = ignore
注意仓库.git目录下的config文件
相关文章推荐
- Git新建本地分支与远程分支关联问题:git branch --set-upstream
- Git新建本地分支与远程分支关联问题:git branch --set-upstream
- Git新建本地分支与远程分支关联问题:git branch --set-upstream
- Git新建本地分支与远程分支关联问题:git branch --set-upstream【转】
- GIT如何查看本地分支与远程分支的关联配置(git branch --set-upstream)
- Git本地分支与远程分支关联问题(git branch --set-upstream-to=origin/<branch> )
- 关于git新建本地分支与远程分支关联问题
- git branch --set-upstream 本地关联远程分支
- git branch --set-upstream 本地关联远程分支
- 解决Git建立远程分支关联时fatal the current branch master has no upstream branch 问题
- git--本地分支同远程分支关联问题
- git本地分支创建后关联远程分支
- git 本地分支和远程分支联系 Threre is no tracking information for the current branch
- git删除远程分支后,本地同步问题
- git远程删除分支后,本地git branch -a 依然能看到的解决办法
- git 本地分支与远程分支关联的一种方法
- 拾遗:git pull 与 push 远程分支与本地分支顺序识别问题
- git查看本地分支关联(跟踪)的远程分支之间的对应关系,本地分支对应哪个远程分支
- git关联本地与远程分支git关联本地与远程分支
- git 新建分支并提交本地代码到远程分支