Skip to content

Making mgit close really useful #84

@Reinmar

Description

@Reinmar

The discussion started in #82 (comment) and continued for a couple next comments.

Initially, I assumed that mgit close should work like git merge on steroids – you call it when on the branch to which you want to merge the given branch. But, in addition to calling git merge, mgit close should also remove the branch from the remote and push the current branch to the remote.

We started discussing whether mgit close should ask whether you want to remove the merged branch from the remote and whether to push the current branch to the remote too. I insisted on this because that:

  • ensures that all branches are closed consistently (you don't forget about anything),
  • it lets you check whether everything worked fine before making the decision (e.g. you can run the tests).

However, then I started realising that there's more about mgit close that we might improve. That it can be far more useful than a simple shorthand to git merge:

  • It can open a text editor so you can easily paste the merge message. This is very important because I still can't use backticks in the -m "" param, despite googling how to do that. Plus, multiline messages are very hard to type in the CLI.

  • The workflow for closing branches is actually different than:

    1. be on master,
    2. merge branch xxx to master.

    When merging, you're usually on the setup of branches you want to close. There may be more branches called xxx in other repos, but you may not be using them at the moment. You are interested in closing exactly what you have there and just tested. Therefore, I want to propose a different workflow.

Workflow

  1. Switch your repository to the setup of branches that you're testing. Usually – you'll change the branch in the main repo and call mgit sync so to use the setup from mgit.json.
  2. Call mgit close (if executed without params it will merge to master).
    1. The command checks which repositories are not on master.
    2. It lists them and lets you unselect the ones you don't want to merge. This is important because often times you want to specify different messages for particular repos.
    3. It opens the OS's text editor so you can type the merge message.
    4. It then performs the merge.
    5. It asks you whether you want to remove the merged branches from the remote. That's a time
    6. It asks you whether you want to push master.
  3. Then you repeat the above for the remaining branches.
  4. Finally, if you didn't decide to push master before merging everything you call mgit push.

That's how my workflow with dealing with branch setups usually looks (but of course I do all those things manually). If mgit close worked this way I feel that it'd be most useful.

Also, please bear in mind that we may still have mgit merge for more git merge-like behaviour. But we should see first if we need it.

WDYT? cc @pjasiun @jodator @oleq

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions