Sublime Forum

How to apply additional flag to a command

#1

I created a new repo on github with a readme file and then pulled it to a local repository which resulted in the error “no tracking information” and refused to merge. I understand that this is a git problem, but the solution to it is to add the flag --allow-unrelated-histories to the pull command to achieve the merge as per this answer - https://stackoverflow.com/a/40107973/4827398

But I’m unable to do that using Sublime Merge. Nothing happens when I type the extra flag and press enter using the Command Palette. I also tried smerge command line tool but it seems that it’s only for diff and merge and not as a full replacement of the git command.

So, any way to execute this command with extra flag without having to install git?

OS: Windows 10
Sublime Merge version: Latest as of posting this.

0 Likes

#2

You can create your own pull command to call with those extra arguments.

Probably something like this:

[
	{
		"caption": "Pull allowing unrelated histories…",
		"command": "git",
		"args": {"argv": ["pull", "--allow-unrelated-histories"]}
	}
]
2 Likes

#3

if you don’t wish to install command line git separately, you can use the git binary that ships with Merge, but it won’t be on your PATH by default, check the installation folder for a git subdir maybe

3 Likes

#4

So currently there is no way to amend existing command with additional args? Like add --recurse-submodules to pull command.

0 Likes

#6

Works! That allows me to access the git command. For people visiting in future, the git directory is in {sublime merge installation directory}\Git\cmd and adding this path to the System PATH variable does the trick.

Though, I have already taken a great liking towards the Sublime Merge’s GUI and I love how easy and fun git becomes with it. So, having a way to add additional args to existing commands would be great.

0 Likes

#7

Correct, not until we get plugin support (on the roadmap), and even then nothing is known at the moment about the level of integration or flexibility plugins could have.

0 Likes