Reputation: 100486
Say I have:
git fetch origin
git status "remotes/origin/master"
I am not sure if I can check the status of a branch that I haven't checked out, so let's say I checkout a branch like so:
git branch foo "remotes/origin/master"
git checkout foo
git status
my question is 2-fold:
Upvotes: 4
Views: 1445
Reputation: 249642
Can I get the git status of a branch without checking it out?
No, because git status
shows the status of the working tree. If you haven't checked out a branch, there is no working tree for it.
Would the git status of foo ever be "unclean"?
It could be, if you have files which are not checked in (and not in .gitignore
). Those files would survive git checkout <branch>
, and would appear as new files in any branch.
Upvotes: 6