git
这是本文档旧的修订版!
Git
Git是一个分布式版本控制系统,目前主要用于管理代码版本。
Common command
Useful command
clean
清理当前工作区为干净工作区:
git clean -d -x -f
bisect
Debug利器,通过二分法查找是哪个 commit
导致的bug
开始,设定在两个commit见二分查找(good为工作正常的commit,bad为工作错误的commit):
git bisect start git bisect bad <commit-id> git bisect good <commit-id> # run and test
如果该commit工作仍然异常:
git bisect bad # 将自动切换到下一个测试commit
直到工作正常为止:
git bisect good # 将输出引入bug的commit
Trick
If you try to delete .git/index.lock
but accidentally delete .git/index
, you can recover this repo by using this commands(All unstaged changes will lose, sorry, blame yourself):
git read-tree --reset HEAD
git.1483783753.txt.gz · 最后更改: 2023/12/03 10:24 (外部编辑)