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

前端 未结 1 731
感情败类
感情败类 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 <branchname> [<start-point>] will create a new branch called <branchname> if it did not exist.
    • git update-ref <branchname> <newvalue> will do nothing in this case.
    0 讨论(0)
提交回复
热议问题