Search code examples
gitterminalscriptinggit-mergegit-subtree

Git Subtree pull and automatically commit the merge


How can I do a git subtree pull and automatically commit the merge?

Here's how I call subtree pull:

git subtree pull --prefix Utils UtilsRepo master --squash

The issue is that this often opens up the vi editor in the Terminal that I just entered the command (I'm on OSX). And then I need to enter ":q" in order to close it again. Since I have multiple subtrees and I want to pull all in a sequence, it's quite annoying to enter ":q" after various pulls.

How to automate this?


Solution

  • In general, if you want to perform any sort of merge without opening the editor to describe the message, set the GIT_MERGE_AUTOEDIT environment variable to no. For example, I have this in my shell configuration, but if you want it only in this case, you could use an alias.