When I run git st(atus)
in a repository with current branch set to master , it says:
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
But when I run that command when I am in branch blah , it says:
On branch blah
nothing to commit, working directory clean
I want it to be checked with the remote branch (being ahead or behind the remote branch blah )
How can I do that?
You need to setup your local branch blah
to track the remote branch origin/blah
:
git checkout blah
git branch --set-upstream-to=origin/blah
or from any branch:
git branch --set-upstream-to=origin/blah blah
You can get a nice summary of the state of your local branches compared to the remote ones they track with git status -vv
<branchname> <head-sha1> [<upstream/branchname>: ahead/behind num] <commit-message>
You can just use diff
git diff --name-status HEAD origin/not-master
To view the difference in terms of non-shared commits:
git log --oneline --left-right --graph --cherry-mark HEAD ... origin/not-master
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.