Git:将本地分支与远程分段和生产进行比较

时间:2014-08-28 23:49:07

标签: git github diff master

我无法将本地主服务器(与origin / master在同一提交中)与production / master进行比较。

$ git remote -v
origin  git@github.com:mydomain/mydomain.git (fetch)
origin  git@github.com:mydomain/mydomain.git (push)
production  git@heroku.com:mydomain-production.git (fetch)
production  git@heroku.com:mydomain-production.git (push)
staging git@heroku.com:mydomain-staging.git (fetch)
staging git@heroku.com:mydomain-staging.git (push)

我似乎能够通过staging/master获得差异,但我在production/master时遇到错误:

$ git diff staging/master
[i'm shown diff]
$ git diff production/master
fatal: ambiguous argument 'production/master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

任何人都能看到我搞砸了什么?

我真正想要做的是看到本地主人的提交不是那些与git diff production/master...master之类的其他遥控器上的提交但是同样的错误:

$ git diff production/master...master
fatal: ambiguous argument 'production/master...master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

1 个答案:

答案 0 :(得分:-1)

我过去使用的是

git fetch production master && git diff master production/master

您之前可能从未从该遥控器中取出。


在查看production/master上但未在本地master上提交的提交方面,git log可能更合适:

git log --oneline production/master..master