我过去git diff origin
经常使用.
在不同的环境中,它不起作用.我不知道为什么.
user@host> git diff origin
fatal: ambiguous argument 'origin': unknown revision or path
not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Run Code Online (Sandbox Code Playgroud)
状态:
user@host> git status
On branch master
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)
遥控器:
user@host> git remote -v
origin https://example.com/repos/djangotools (fetch)
origin https://example.com/repos/djangotools (push)
Run Code Online (Sandbox Code Playgroud)
版:
user@host> git --version
git version 2.7.4
Run Code Online (Sandbox Code Playgroud)
用"git版本1.8.1.4" git diff origin
工作.
顺便说一句,如果我使用"git diff origin/master",我会看到相同的错误信息
BTW2,我认为"/ master"是多余的.理所当然的默认设置是将本地分支与远程站点上的同一分支进行比较.
我的团队交替使用dev和master作为几个repos的默认分支,我想编写一个脚本,在输入目录时检查默认分支.
当在某些repos中打开pull请求时,它们默认为'dev'或'master'作为合并目标.
我了解如何设置此信息但不检索它:https: //help.github.com/articles/setting-the-default-branch/
是否有可用于确定远程存储库的默认分支的git命令?
git ×2