回购中缺少头部和原点

时间:2017-08-04 10:01:53

标签: git github atlassian-sourcetree

我对git系统有点新意,我想了解一点,也许它甚至都不是问题。我有3个项目,其中两个在上次提交中有原始/主/头签名,一个只有主人:为什么?

我读到了这个答案,但对我来说并不完全清楚:How to add missing origin/HEAD in git repo

非常感谢

Where are head and origin?

1 个答案:

答案 0 :(得分:1)

If the repo is only a local repo, you will not have a any origin/** branches in your log. You can check this with the command git remote, if this returns "origin", it is a remote repo and you will have the origin-branches. Though it might not always be on the last commit. If you make a commit locally, i.e. git commit -m "My commit" the commit will only exist locally and not in the remote yet. If you do a git push you will move the origin/HEAD to you last local commit.

In you picture, it doesn't look like you have added any remotes, thus the repo only exists on your local machine. If you e.g. clone an already existing repo, it will exist both locally and in the remote, and you will have the origin/HEAD branch you are referring to.

You can add a remote as well, by git remote add origin <repo url>. Where origin is a name, you can call your remotes whatever you want.