![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
git
强哥之神
格物致知
展开
-
如何写好 Git Commit 信息
英文: http://chris.beams.io/posts/git-commit/中文: http://blog.jobbole.com/92713/转载 2015-12-01 13:26:13 · 773 阅读 · 0 评论 -
fatal: Cannot update paths and switch to branch 'gitlab' at the same time.
I believe this occurs when you are trying to checkout a remote branch that your local git repo is not aware of yet. Try:git remote show origin If the remote branch you want to checkout is under “New r原创 2015-10-22 18:42:58 · 5986 阅读 · 0 评论 -
git 添加远程分支,并可以code review.
需要以common repo (gitlab)中的某个branch( remote_xxx)为基础,建立要添加的branch (new_xxx), 假设远程自己的repo为(origin)如果远程repo name为 gitlab.则:git checkout gitlab/remote_xxx -t -b remote_xxx(把远程的code拉到本地)git checkout -b new_原创 2016-01-07 18:22:45 · 3191 阅读 · 0 评论 -
Git 修改历史提交
参见github流程图,我们公司内部则采用gitlab,原理也一样。如果git 只需要修改最近一次提交的commit信息或代码,则可以通过如下方式解决: git add xxx git commit --amend -s git push [remote-repo-branch] [local-dev-branch] git需要修改非最后一次的历史提交呢,就必须使用rebase了。 比如原创 2016-01-07 22:48:11 · 643 阅读 · 0 评论 -
git 自动补全 (git auto completion)
下载git-completion.bash 并放到home 目录下: curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash 将如下行放到.bash_profile 文件中 if [ -f ~/.git-comp原创 2016-01-26 10:14:39 · 4675 阅读 · 0 评论 -
设置git使用vim作为编辑器
git 默认使用emacs作为编辑器,我们可以如下任何一种方式来使用VIM在git config中设置core.editor: git config --global core.editor "vim"在环境变量中设置GIT_EDITOR: export GIT_EDITOR=vim如果不仅希望git使用vim, 还想其他的程序也使用则可以如下设置: 注意:如下两个标准的环境变量其实不是原创 2016-02-24 11:24:53 · 54282 阅读 · 4 评论 -
Please supply the message using either -m or -F option.
在mac中,如果使用 git commit –amend,会出现如下错误:error: There was a problem with the editor ‘vi’. Please supply the message using either -m or -F option.原因是vi有问题,需要为 git 换一个默认的编辑器,比如 vim,如下进行配置即正常了。git config --g原创 2017-03-30 20:36:30 · 3400 阅读 · 0 评论 -
git log 乱码解决方法
先看下 LANG 环境变量是否为统一字符编码: $ echo $LANG; 输出结果为空 执行export LANG="zh_CN.UTF-8"命令,问题能否解决?如果不能,再试下修改 git configgit config --global i18n.commitencoding utf-8git config --global i18n.logoutputencoding ...原创 2018-06-30 11:22:36 · 12716 阅读 · 0 评论