Sublime Forum

Add untracked file?

#1

Is there any way to “git add -f” an untracked file, either from Sublime Merge or SublimeText? It is the only common operation I need to use the git cli for these days. Otherwise, Sublime Merge is doing everything for me.

1 Like

#2

Maybe a bit tricky to find as untracked files are organized under a dedicated section, but adding untracked files is as easy as staging changes.

Note:

I often miss to stage the new files after renaming them which results in the old one just being committed as deleted rather than renamed.

While it helps keeping propably unwanted files out of sight this feature unfortunatelly very often causes important files to be missed in commits.

3 Likes

#3

Oh thanks, deathaxe, but I guess I forgot to specify, I’m talking about files that are NOT in the Untracked Files list because they are excluded by my .gitignore file. They are files I usually do not want to change, but every now and then I need to.

0 Likes

#4

I don’t see a chance with Sublime Merge as it completely hides ignored files.

If you use GitSavvy in ST, you could try the gs_custom command to create a command palette entry (or key binding) to force stage an opened file.

	{
		"caption": "git: stage current file",
		"command": "gs_custom",
		"args": {
			"args": ["stage", "-f", "{FILE_PATH}"],
			"start_msg": "Stage file...",
			"complete_msg": "File staged",
		}
	},
0 Likes