指令
git commit --amend发现上次提交的bug,修改更新上次的提交记录git log --graph --pretty=oneline --abbrev-commit更简单地:
git log --graph --oneline --all可以在终端显示分支图
git checkout -b test_merge新建test_merge分支并进入git branch -d test_merge删除test_merge分支git reset --hard savepoint,返回到savepoint分支时刻(此时刻之后的提交全部不见)git cherry-pick+commit ID,在git树中挑选commit节点,接在当前节点之后git rebase foo bar其中foo和bar都是标签快速将bar的整个分支更新到foo之后
思想
Merge
- The Scout Pattern
- Which means a branch is a pioneer who tests whether there’s sth. wrong ahead.
- The Savepoint Pattern
- Which means a branch is a savepoint here
其他
在执行一些你不确定的git指令的时候,可以先如下进行备份,再尝试
1 | cd .. |