记录一些git小知识
push
force-with-lease
可以在rebase后force, 同时避免覆盖他人提交, 具体见 git push --help
git push origin --force-with-lease
This option allows you to say that you expect the history you are updating is what you rebased and want to replace. If the remote ref still points at the commit you specified, you can be sure that no other people did anything to the ref. It is like taking a "lease" on the ref without explicitly locking it, and the remote ref is updated only if the "lease" is still valid. --force-with-lease alone, without specifying the details, will protect all remote refs that are going to be updated by requiring their current value to be the same as the remote-tracking branch we have for them.
merge
查看分叉点
~/ejoy/battleship(etcd1) » git merge-base --fork-point master etcd1
489889ee3e6ab88f5be217590b9bcfab908227da
rebase
interactive rebase 时显示作者和commit msg
git config --add rebase.instructionFormat "(%an <%ae>) %s"
git config --global rebase.instructionFormat "(%an <%ae>) %s"
|