zoukankan      html  css  js  c++  java
  • git 版本控制 git push.default 的设置

    在新装的 ubuntu 的笔记本上搭建开发环境,新装的软件也都是比较新的,在使用 git 的时候,就出现了一些新情况,以前没有看见的。虽然说是警告,作为一个名程序员,不应该 care warning 的,但是作为一名处女座的程序员,实在是不能容忍这个该死的 warning 总是出现在我提交代码的时候。于是看一下。转载请注明来自:http://www.binkery.com/

    warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use:转载请注明来自:http://www.binkery.com/

    git config --global push.default matching
    

    To squelch this message and adopt the new behavior now, use:转载请注明来自:http://www.binkery.com/

    git config --global push.default simple
    

    When push.default is set to 'matching', git will push local branches to the remote branches that already exist with the same name. 使用 matching 的话,就可能出现这种情况,你在当前某个分支工作,做一半的时候,来了个紧急的任务,你切换到其他分支去工作了,当你修改完代码后提交代码,这个时候可能会把其他分支的代码一块提交了,这可能不是你想要的。为了谨慎起见,我一直都是使用 simple 的方式提交,哪怕多出一些工作量,也要谨慎。转载请注明来自:http://www.binkery.com/

    In Git 2.0, Git will default to the more conservative 'simple' behavior, which only pushes the current branch to the corresponding remote branch that 'git pull' uses to update the current branch.转载请注明来自:http://www.binkery.com/

    See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git)转载请注明来自:http://www.binkery.com/

    其实就是一个问题,push 的时候,提交多少个分支的代码。是当前的分支呢?还是所有本地和服务器名字一样的分支? simple 是 push 当前分支,也就是通过 git pull 命名更新的分支,而 matching 提交的是名字一样的分支,只有服务器存在名字一样的,都提交。转载请注明来自:http://www.binkery.com/

    另外,还有个 current 的模式,如果 git 版本比较早的话,可以使用 current 模式。

  • 相关阅读:
    浅析Java中的final关键字
    Eclipse导入到web项目没有run on server
    解决web项目无法部署到eclipse配置的本地tomcat
    Eclipse 导入外部项目无法识别为web项目并且无法在部署到tomcat下
    JAVA – 虚函数、抽象函数、抽象类、接口
    jsp分页
    连接数据库查询数据
    (转)解决emacs中切换输入法冲突
    sqoop的使用
    hive的使用03
  • 原文地址:https://www.cnblogs.com/arenouba/p/5441062.html
Copyright © 2011-2022 走看看