Setup: 3 git repos - on github, local and on staging server.
I develop locally, push it to github and staging server pulls.
I don't work nor commit changes on staging server, but I must have done so long time ago. Because now I get the following message when I do git status
(on staging server):
On branch SOME_BRANCH
Your branch and 'origin/SOME_BRANCH' have diverged,
and have 4 and 32 different commit(s) each, respectively.
My question is: how do I see those exact 4 commits that are not at origin
?
git rev-list origin..HEAD
这将列出分支(HEAD)中不在原点的提交。
Generically, if your remote is called foo and your branch is bar :
git rev-list foo/bar..HEAD
@charlesb is the answer for being in the master branch with remote called origin.
show the commits exist in origin but not local:
git rev-list HEAD..origin --pretty
show the commits exist in local but not origin:
git rev-list origin..HEAD --pretty
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.