分享

git tips

 行者花雕 2020-03-08

记录一些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"

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多