开发者

Git --bare ... Why does fetch not always show the most recent commits?

I have a few GIT repos that I mirrored locally to show up in my JIRA instance, but I have noticed some (to me) strange behaviour.

I have a repo, we will call this "myrepo". If I do a git clone, and git pull, I always get the mos开发者_StackOverflow社区t recent commits.

However, when I do a git clone --bare, when I do a "git fetch" from my bare repository, I do not get the newer commits showing up in my "git log".. Why is this?


The fetch isn't moving your HEAD. Therefor, the log is only showing you the history from where HEAD was before the fetch. Try git log -all. This will show you the history of all branches, including the remote one you fetched in.

Also git log remoteBranchName will work if you know the name of the remote branch you are interested in.

If you want all everything to be in sync with the remote master, you have to run either git fetch, then git merge or just run git pull which is the same as running fetch and merge. If you prefer a specific branch - ex. master - git pull origin master

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜