吓人的警告。git config push.default matching

升级到 git 1.6.3 以后,每次 git push 的时候都会出现这样“吓人”的警告。

warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated.  This may
warning: not necessarily be what you want to happen.
warning:
warning: You can specify what action you want to take in this case, and
warning: avoid seeing this message again, by configuring 'push.default' to:
warning:   'nothing'  : Do not push anything
warning:   'matching' : Push all matching branches (default)
warning:   'tracking' : Push the current branch to whatever it is tracking
warning:   'current'  : Push the current branch
通常,这是很多 Linux 或者说开源社区贴心的地方,主动告诉你,“注意了,我们发布了一个新版本,有些地方和之前的不太一样,需要你自己动手改一下”。。。只是,为什么不直接给出一条简单明了的指令呢?比如,
git config push.default current

这样执行git push的时候,只会push当前的branch,如果设置为matching的话,会push所有的有改动的branch到相应的repository的ref中,相对来说安全性差了点。

另外,我还看到了一篇blog1,讲述了10个升级到1.6.3的理由,除了性能和易用性上的改进之外,又学到了几个新的命令:
1.git diff —staged 等同于 git diff —cached
2.git checkout - 返回之前的branch,类似bash。
3.git log —graph 相当于一个终端版的gitk
4.git log —oneline 精简版的log信息,只有changeset号的前7位和commit信息。
END

0 Responses to "吓人的警告。git config push.default matching"