1

当我git st(atus)在当前分支设置为master的存储库中运行时,它说:

On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

但是当我在分支blah中运行该命令时,它会说:

On branch blah
nothing to commit, working directory clean

我希望它与远程分支一起检查(在远程分支之前或之后等等

我怎样才能做到这一点?

4

2 回答 2

2

您需要设置本地分支blah 来跟踪远程分支 origin/blah

git checkout blah
git branch --set-upstream-to=origin/blah

或从任何分支:

git branch --set-upstream-to=origin/blah blah

与他们跟踪的远程分支相比,您可以获得本地分支状态的一个很好的摘要git status -vv

<branchname> <head-sha1> [<upstream/branchname>: ahead/behind num] <commit-message>
于 2015-07-13T22:53:59.230 回答
1

你可以只使用差异

git diff --name-status HEAD origin/not-master

要查看非共享提交方面的差异:

git log --oneline --left-right --graph --cherry-mark HEAD ... origin/not-master
于 2015-07-13T22:52:29.947 回答