gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 14:25:10 25 4
gpt4 key购买 nike

我在比较本地 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>...]'

最佳答案

我以前用过的是

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

您以前可能从未从那个远程获取数据。


就查看不在 production/master 上但在本地 master 上的提交而言,git log 可能更好适合:

git log --oneline production/master..master

关于Git:将本地分支与远程暂存和生产进行比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25559691/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com