给git pull默认加上rebase功能

xiaoxiao2021-02-28  136

git pull时可以加上--rebase参数, 使之不产生Merge点, 保证了代码的整洁, 即: git pull --rebase

但每次都加--rebase似乎有些麻烦,我们可以指定某个分支在执行git pull时默认采用rebase方式:

  $ git config branch.dev.rebase true

请使用以上命令时将 "dev" 修改成您自己本地的分支名字.

提示: 

      必须cd到你工程的目录下,才能更改分支的配置;

      可以使用  git branch 命令, 列出您当前仓库中的所有本地分支;

如果你觉得所有的分支都应该用rebase,那就设置:

  $ git config --global branch.autosetuprebase always

这样对于新建的分支都会设定上面的rebase=true了。已经创建好的分支还是需要手动配置的。

参考链接:

http://www.tuicool.com/articles/NzeQZz3

转载请注明原文地址: https://www.6miu.com/read-69913.html

最新回复(0)