cleung2010
cleung2010

Reputation: 307

git status of another remote

I added a second remote by issuing:

git remote add stash ...

However, when I do

git status

It checks for the status of origin/master. How can I issue a git status to check for the status of the second remote, in this case "stash". I tried the following commands, but they still track origin/master:

git status stash/master
git status "stash/master"

Thanks in advance for the input!

Upvotes: 14

Views: 8454

Answers (2)

Andrew C
Andrew C

Reputation: 14843

git status uses the configured information for the branch in the repository config file ( (repo)/.git/config) to show status.

If you wish to change that, you will need to change what your branch is tracking. You can do that a variety of ways. For newer versions of git use

git branch --set-upstream-to=stash/master

Note that stash is a command in Git, so I would not recommend using it as a name for a remote because it could cause potential confusion.

Upvotes: 11

G. Allen Morris III
G. Allen Morris III

Reputation: 1042

The comamnd

git status

gives you the status of the working tree.

If you would like to 'use' the 'stash/master' tree you need to pull it with

git pull stash master

then the working tree will be pointing to 'stash/master'.

If you want to see what the pull will do before running it see: How to preview git-pull without doing fetch?

Addendum:

Look at the link below to see how to get you master branch to follow a different remote.

Make an existing Git branch track a remote branch?

Upvotes: 2

Related Questions