1.操作log
git reflog
2.合并最后一次提交:
$ git reset --soft HEAD^1
$ git commit --amend
3.合并多个提交
合并 branch A上的n个提交到branch B
git merge --squash A
4.rebase 依赖分支
git review -d $PARENT_CHANGE_NUMBER
git review -x $CHILD_CHANGE_NUMBER
git review
5.显示分支图
git log --graph --pretty=oneline --abbrev-commit
6.Fix:
1. git review error: unpack failed: error Missing tree
git push --no-thin gerrit HEAD:refs/publish/icehouse/update_spec
2.Changing a commit message
https://help.github.com/articles/changing-a-commit-message/
7. Problems encountered installing commit-msg hook The following command failed with exit code 1 "scp :hooks/commit-msg .git/hooks/commit-msg"
gitdir=$(git rev-parse --git-dir); scp -p -P 29418 username@review.openstack.org:hooks/commit-msg ${gitdir}/hooks/