How can I see the default remote repository set on my Pycharm?
I want to know when I type git push without specifying the repository name, which of my remote repository is going to be updated, assuming that I have added multiple remote repository with different alias names.
To get the default remote to push to, you can use %(push:remotename) in format:
git for-each-ref --format='%(push:remotename)' $(git symbolic-ref HEAD)
To get the default remote to pull from, you can use %(upstream:remotename) in format:
git for-each-ref --format='%(upstream:remotename)' $(git symbolic-ref HEAD)
You can also use git branch --list but somehow it's slightly slower (0.1s vs 0.2s on my machine).
(original answer below)
It seems like git ls-remote --get-url is the command. It prints URL instead of the remote name, but it was sufficient in my case. git ls-remote assumes the default remote if you don't provide one, so you can get the default remote URL with it. The doc was not very clear about the usage though.
Edit: Turns out it's the default URL to pull from, not push to. Better options above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With