git使用的技巧和问题

来源:互联网 发布:mac的终端是什么 编辑:程序博客网 时间:2024/06/01 10:29

(1)配置git的编辑器

git config --global core.editor vim

(2)也可以配置些system的东西,查看配置项的方法是:

git config -l
配置linux和windows的回车不同的方法

git config --system autocrlf=false

(3)修正提交记录的方法:

其中amend的是修正上次提交的提交
真正合并分支的方法是rebase。

(3)比checkout要快的版本更换方法;

git bisect startgit bisect badgit bisect rest

(4)查找每一行代码的修正时间的方法;

git blame xx.cpp

(5)比push --f更好的方法 是--force-with-lease

(6)对已建立的库增加ignore的方法是;

git rm -r --cached .git add .git commit -m 'update .gitignore'

不过相当于重新建库,所以在建立git库之初最好编辑好.gitignore文件。


原创粉丝点击