git commit模板配置:
cat ~/commit.template
[bugid]:xxx
[type]:feature/bug
[subject]:fix xxx
[scope]:audio
[build]:pass
[test]:pass
git config全局配置:
git config --global commit.template ~/commit.template
git config --global core.editor vim
git commit回退:
git reset --soft HEAD^
撤回commit操作,写的代码仍然保留
2次commit,想都撤回,可以使用HEAD~2
撤回commit后可修改,然后重新add,commit上传
git pull会把本地未提交修改覆盖吗?
git pull会把本地未提交修改覆盖。
处理的方式非常简单,主要是使用git stash命令进行处理,分成以下几个步骤进行处理。
1、先将本地修改存储起来
$ git stash
这样本地的所有修改就都被暂时存储起来 。是用git stash list可以看到保存的信息:
git stash暂存修改
其中stash@0就是刚才保存的标记。
2、pull内容
暂存了本地修改之后,就可以pull了。
$ git pull
3、还原暂存的内容
$ git stash pop stash@0