-
Notifications
You must be signed in to change notification settings - Fork 9
Description
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:
- be on
master, - merge branch
xxxtomaster.
When merging, you're usually on the setup of branches you want to close. There may be more branches called
xxxin 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. - be on
Workflow
- 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 syncso to use the setup frommgit.json. - Call
mgit close(if executed without params it will merge tomaster).- The command checks which repositories are not on
master. - 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.
- It opens the OS's text editor so you can type the merge message.
- It then performs the merge.
- It asks you whether you want to remove the merged branches from the remote. That's a time
- It asks you whether you want to push
master.
- The command checks which repositories are not on
- Then you repeat the above for the remaining branches.
- Finally, if you didn't decide to push
masterbefore merging everything you callmgit 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.