glab icon indicating copy to clipboard operation
glab copied to clipboard

Warn if branch not published

Open penx opened this issue 4 years ago • 4 comments

Describe the feature or problem you'd like to solve

If you try to run glab mr create on a branch that only exists locally, a merge request is created from a non existent branch with no changes.

Propose a Solution

Option to warn or block glab mr create if the branch doesn't exist on the remove.

penx avatar Mar 15 '22 14:03 penx

Hi @penx

I guess we could show some kind of info text that nothing is pushed to the remote and it's an empty MR, but I don't think this is really needed since it's a completely valid thing to do in GitLab.

And if you want to push your current branch you can use the --push flag.

zemzale avatar Mar 15 '22 15:03 zemzale

A warning would be great, for me due to me wrongly thinking I'd pushed a branch and then distributing the MR link with my team only to later be told the MR is blank 😄 (I've done this about 4 times over the past couple weeks! I'm used to hub which I think prevents a PR being created)

Yes I could start using --push by default instead...

Thanks for glab 🙂

penx avatar Mar 15 '22 15:03 penx

You can use an alias for this. I have one called mrc that does all the stuff I need for MR

You can do it like glab alias set mrc "mr create -a=@me --remove-source-branch --push

zemzale avatar Mar 15 '22 16:03 zemzale

This issue has been automatically marked as stale because it has not had recent activity. We haven't had the time to address it yet, but we want to keep it open. This message is just a reminder for us to help triage issues.

clemsbot avatar Apr 15 '22 03:04 clemsbot