6

Is there a way to get git status to show 2 remotes?

Basically I have origin set to the Fork of a github project and upstream to the Fork's parent project. On the github page for my Fork it lists something like this

This branch is 1 commit ahead, 9 commits behind othergithubuser:master

Essentially, I'm looking for git status(or some way) to replicate this

.git/config

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://github.com/mygithubuser/project.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[remote "upstream"]
    url = https://github.com/othergithubuser/project.git
    fetch = +refs/heads/*:refs/remotes/upstream/*
Necrolyte2
  • 738
  • 5
  • 13
  • Are you always going to want to push/pull from both at the same time? If so you should be able to put both urls under `origin` and when you run `git push origin master` it'll push to both (I'm not sure what this would do to `git status` though) – frostmatthew Nov 26 '14 at 14:29
  • I probably won't ever push to upstream since I don't have write access to that repo. – Necrolyte2 Nov 26 '14 at 14:37
  • git status displays paths that have differences between the index file and the current HEAD commit. No matter how many remotes you have your HEAD is the same thus result of git status for all origins would be the same. – astroanu Nov 27 '14 at 12:13

2 Answers2

1

What you are asking isn't supported in GIT yet.

When you run git status its comparing your current working directory & index against the current HEAD.

Keeping the above in mind we can see that git doesn't care where the content came from or will it be pushed to. Its like that by design.

If you stop for a moment and you think about it it makes sense that git status has no clue from where and to where the code will go to.

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
0

Type git help status in the terminal and see the command description, you would see that you can't do so at the moment

Displays paths that have differences between the index file and the current HEAD commit, paths that have differences between the working tree and the index file, and paths in the working tree that are not tracked by Git (and are not ignored by gitignore(5)). The first are what you would commit by running git commit; the second and third are what you could commit by running git add before running git commit.

Sean Vieira
  • 155,703
  • 32
  • 311
  • 293
Ducky
  • 2,754
  • 16
  • 25