profclems / glab

The GitLab CLI tool. Archived: now officially adopted by GitLab as the official CLI tool and maintained at https://gitlab.com/gitlab-org/cli. See https://github.com/profclems/glab/issues/983
https://glab.readthedocs.io/
MIT License
2.08k stars 163 forks source link

Warn if branch not published #979

Open penx opened 2 years ago

penx commented 2 years ago

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.

zemzale commented 2 years ago

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.

penx commented 2 years ago

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 🙂

zemzale commented 2 years ago

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

clemsbot commented 2 years ago

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.