Is it better to use git branch -f or git update-ref to fast-forward existing branch?

前端 未结 1 730
感情败类
感情败类 2021-01-16 09:49

I have realized that I can use git update-ref to fast-forward existing branch that I am not on. Then I have found that similar thing can be done by git branch -f

1条回答
  •  北海茫月
    2021-01-16 10:39

    With git branch -f, it would refuse to update the branch if it is the one checked out (so if it is the "current branch")

    git update-ref has not that limitation.


    Qqwy adds another difference in the comments:

    • git branch -f [] will create a new branch called if it did not exist.
    • git update-ref will do nothing in this case.

    0 讨论(0)
提交回复
热议问题