Preview changes on bare repo doesn't work correctly
Ok, I'm starting to get the hang of things.
When previewing changes to a repo prior to pulling from it, why doesn't it show the changes I've made in my clone repo if I do the following?
git fetch
git log HEAD..origin
Please see this thread on how my workflow is setup. GIT - Difference between tracking a branch versus cloning
If I run the commands above in a cloned repo it works fine. I can see the changes I made in 开发者_开发百科the "log" file. If I run it on my laptop (the original place where initialize git from), I don't get an update when running the git log command. I can run git pull and it pulls the new changes over just fine.
Is it because I'm not "tracking" the repo?
Okay, I've had some trouble sorting through what you described of your workflow. In particular, I'm not sure how you got content into your VPS repo... but I'll assume you did it somehow.
Edit: origin
in this case is in fact a synonym for origin/HEAD, so the command should still work, though it's often a good idea to explicitly specify the branch. If you get into the habit of using HEAD..origin
you may well try to use it on a branch besides master, and then end up effectively doing dev..origin/master
which is not at all what you want!
The issue was most likely because the remote had never actually been fetched, which in turn was due to the way the origin remote was added to the repository. In fact, git should give an error in this case:
fatal: ambiguous argument 'HEAD..origin': unknown revision or path not in the work tree
Use '--' to separate paths from revisions
Thanks to Jakub Narębski for setting me straight here!
精彩评论