Git新建本地分支与远程分支关联问题:git branch --set-upstream

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的更多相关文章

  1. git 在本地拉取远程分支的代码(并不做提交操作)

    1. git fetch 获取远程的所有分支 2. 在执行 git checkout -b local-branch-name origin/remote-branch  就可以将远程分支remote ...

  2. Git新建本地分支与远程分支关联问题:git branch --set-upstream【转】

    本文转载自:http://blog.csdn.net/netwalk/article/details/21088405 Git新建本地分支与远程分支关联问题:git branch --set-upst ...

  3. git 本地分支与远程分支关联的一种方法

    github上已经有master分支 和dev分支 在本地 git checkout -b dev 新建并切换到本地dev分支 git pull origin dev 本地分支与远程分支相关联 在本地 ...

  4. git 本地分支与远程分支 新建/删除/合并

    github上已经有master分支 和dev分支 在本地 git checkout -b dev 新建并切换到本地dev分支 git pull origin dev 本地分支与远程分支相关联 在本地 ...

  5. [Git] 将本地分支与远程分支关联

    . . . . . 在本地工程中添加Git,并将其与远程的空库关联起来,只需如下几步. 1. 创建空库 $ git init Initialized empty Git repository in D ...

  6. Git本地分支和远程分支关联

    转载:https://blog.csdn.net/cherishhere/article/details/52606884 转载:https://blog.zengrong.net/post/1746 ...

  7. git 新建本地分支后将本地分支推送到远程库, 使用git pull 或者 git push 的时候报错

    是因为本地分支和远程分支没有建立联系  (使用git branch -vv  可以查看本地分支和远程分支的关联关系)  .根据命令行提示只需要执行以下命令即可git branch --set-upst ...

  8. Git 操作本地分支与远程分支

    1 查看本地分支 git branch 2 查看远程分支 git branch -a 3 新建远程分支 git checkout -b developr git push origin develop ...

  9. git 本地分支与远程分支

    github上已经有master分支 和dev分支 在本地 git checkout -b dev 新建并切换到本地dev分支 git pull origin dev 本地分支与远程分支相关联 在本地 ...

随机推荐

  1. Javascript基础form表单

    <!DOCTYPE HTML> <html> <head> <script type="text/javascript" charset= ...

  2. easyui combobox赋值

    $('#cc').combobox('setValue','bitem3').combobox('setText','bitem3')

  3. Palindrome Number 回文数

    判断一个数字是否是回文数,尝试不用其他额外空间. 注意: 负数也有可能成为回文数吗? 如果你想让int转为string,注意不用其他空间这个约束. 你也可以翻转一个int,但是有可能会溢出.     ...

  4. Access restriction: The type * is not accessible due to restrict,报错问题

    解决方案1: Eclipse 默认把这些受访问限制的API设成了ERROR.  Windows -> Preferences -> Java -> Compiler -> Er ...

  5. 使用python发邮件

    使用python发邮件 网上有很多发邮件的例子,本人在网上找了一份,稍加修改后使用 上源码 # encoding=utf-8 from email.mime.image import MIMEImag ...

  6. Android ListView SimpleAdapter支持Bitmap类型图片显示

    // 处理simpleAdapter中包括bitmap类型 adapter.setViewBinder(new ViewBinder() { public boolean setViewValue(V ...

  7. keepalived+httpd 做web服务的高可用

    场景: 环境中有两台httpd服务器,一台做主,一台做备用:平时只用主向外提供http服务:当主宕机后,keepalived把vip绑定到备机上去,这样就由备机提供http服务了. **keepalv ...

  8. 拼接xml时出现内存溢出解决办法

    /// designed by Alex /// 解决内存溢出问题,不可使用迭代器和foreach /// 循环遍历List, 别生成xml,一边释放 /// 反向遍历,相当于出栈,避免索引顺序乱的问 ...

  9. 开心菜鸟学习系列笔记-----Javascript(1)

    js 一些常见的使用方法        // target : 不管是否出现冒泡,他都是代表最开始引发事件的对象   // this   : 是指当前函数.  //ie 事件对象   : window ...

  10. BIT_COUNT()和BIT_OR()

    在学习MySQL手册时,看到根据天数计算访问量时,出现了BIT_COUNT()和BIT_OR()两个函数来处理天数计算的问题 所使用的表格信息如下: mysql> select year,mon ...