You could just avoid opening Vim in the first place.
One option for that is to make use of the --message=<message>
(or -m <message>
, for short) option to git subtree pull
. The downside is that you can't use the default message provided by git and instead have to come up with your own. The upside is that this should work just about anywhere that git needs a commit message.
Another option which does use the default message is to change the "editor" that git opens to cat. Just remember to change it back immediately after:
git config --local core.editor /path/to/cat
git subtree pull --prefix foo/bar/path repo branch --squash
git config --local core.editor /path/to/vim-or-other-editor
The upside to this is that you can use the default message provided by git. The downside is that this won't work if the default commit message is empty, as is typical when doing a plain git commit
.
And what Git task, exactly, is it? – Daniel B – 2017-01-31T17:55:01.687
@DanielB
git subtree pull --prefix foo/bar/path repo branch --squash
– JETM – 2017-01-31T18:01:47.0931Have you tried using
git subtree
's--message=
(or-m
) option to provide a commit message ahead of time? That should avoid opening up vim in the first place. – 8bittree – 2017-01-31T19:12:32.423@8bittree Good idea. It's preferable that I retain the auto-generated message, but I'm sure I can work out some hackery to derive it, if there's nothing simpler. – JETM – 2017-01-31T19:33:05.013
@8bittree Perfect! – JETM – 2017-01-31T19:47:36.857
I've edited your question (pending approval) to focus more on your actual problem, rather than the one specific potential solution. Feel free to reject my edit or roll it back if you disagree with my changes. – 8bittree – 2017-01-31T20:41:52.243