Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git status of another remote

Tags:

git

status

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!

like image 712
cleung2010 Avatar asked Oct 14 '14 19:10

cleung2010


2 Answers

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.

like image 77
Andrew C Avatar answered Sep 27 '22 18:09

Andrew C


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?

like image 31
G. Allen Morris III Avatar answered Sep 27 '22 17:09

G. Allen Morris III