Re: obnoxious CLI complaints
- From
Björn Steinbrink <b.steinbrink@gmx.de>
- Date
- Sep 10, 2009, 01:32 UTC
- Message-ID
- <20090910013235.GA9980@atjola.homenet>
- In-Reply-To
- <ef38762f0909091427m5b8f3am72c88fd4dbfebc59@mail.gmail.com>
On 2009.09.09 14:27:56 -0700, Brendan Miller wrote:
Show 5 quoted lines
> 8. There's no obvious way to make a remote your default push pull > location without editing the git config file. Why not just something > like > > git remote setdefault origin
Because "git remote" is the wrong tool. The default remote for fetch/push is configured per branch head, not globally.
> or even > > git remote add --default origin http://somegiturl.org/
Because that would likely mean changing all the existing branch head configurations, quite possibly making them invalid, because the branch.<name>.merge value suddenly makes no sense anymore.
> This come up in the use case where I: > 1. set up a remote bare repo > 2. push from my local repo, and thence forth want to keep local and > remote in sink.
Maybe you want something like this? http://thread.gmane.org/gmane.comp.version-control.git/107671
> Right now I have to modify .git/config to do this.
You can also do: git config branch.<name>.remote <remote>
which does the config editing for you.
And maybe: git config branch.<name>.merge <ref>
if you also want just "git pull" to work, or use push.default = tracking.
There's also still my old "retrack" hack, which John Wiegley extended: http://github.com/jwiegley/git-scripts/blob/6ba3184d7b9f6dae3d10379a6bac29a01ceef190/git-retrack
That's a bit more comfortable, but probably doesn't work for a lot of "non-standard" setups.
Björn