Is “refs/heads/master” same as “refs/remotes/origin/master” in Git?

后端 未结 2 1718
走了就别回头了
走了就别回头了 2021-02-01 02:30

The question is simple: is refs/heads/master the same thing as refs/remotes/origin/master? If it is not in some cases, how can I know when it is not an

2条回答
  •  无人共我
    2021-02-01 03:02

    They are two different symbolic names that can point to different things. refs/heads/master is a branch in your working copy named master. Frequently that is a tracking branch of refs/remotes/origin/master because origin is the default name for the remote created by git clone and its primary branch is usually also named master.

    You can see the difference between them with git rev-list refs/heads/master..refs/remotes/origin/master which will be empty if they are the same and will otherwise list the commits between them.

提交回复
热议问题