New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mr checkout
: specify the tracking remote
#774
Comments
On Mon, Jan 03, 2022 at 10:52:04AM -0800, claytonrcarter wrote:
I don't use the "1 remote/author" workflow at work; instead we all push
branches to a single, shared `origin` where only some of us have permission
to merge to `main`. As written, `mr checkout -t <id>` will create/update
a remote named after the MR author. In my case, this ends up w/ 2 remotes
both pointing to the same URL, which doesn't feel helpful to me. I have
hacked around this locally, but before I go making it pretty I'd like to
know if anyone else wants this. 😛
I use the same workflow, so yes, that sounds useful.
I didn't look into the UI, but maybe we can use the remote specified in `git config remote.pushDefault`.
|
It seems indeed useful and I would like to test it myself actually :)
Yeah, it would require to specify two flags with the same name, being one a bool and the other string, otherwise the second bullet will eat the following string in the CLI as the flag value (even if the next string starts with
Using the git options here is indeed a valid option, maybe "use |
Wouldn't it be better to detect that the MR remote matches the default remote and pick that automatically? The proposed CLI flag sounds like a workaround for something that shouldn't be done in the first place. |
@fmuellner That's actually a pretty good point. |
@claytonrcarter @fmuellner please take a look at the PR #786 . |
I don't use the "1 remote/author" workflow at work; instead we all push branches to a single, shared
origin
where only some of us have permission to merge tomain
. As written,mr checkout -t <id>
will create/update a remote named after the MR author. In my case, this ends up w/ 2 remotes both pointing to the same URL, which doesn't feel helpful to me. I have hacked around this locally, but before I go making it pretty I'd like to know if anyone else wants this. 😛My existing hack is just an add'l flag
--track-default-remote
that tellsmr checkout
usetargetRemote
instead of creating a new remote based onmr.Author.Username
.Any interest?
BTW I looked into some way to support something like this:
--tracking-remote
not specified on command line: usemr.Author.Username
(current behavior)--tracking-remote
specified but w/ no value: use default remote--tracking-remote=<remoteName>
: use remote namedremoteName
I got stuck on this b/c I couldn't (quickly) figure out how to coax pflags into working w/ some sort of flag that has different values if it's not specified, vs if it's passed but w/o a value vs w/ a value. (Or even if such a thing is possible.) I eventually just settled for the default remote being fine for me. 😄
The text was updated successfully, but these errors were encountered: