Sublime Forum

Stop Tracking / Remove File or Folder

#1

Is there a way to stop tracking and remove a folder from within Sublime Merge (or Sublime Text) ?

I might just be missing something obvious, but I ended up just adding the folder to .gitignore and then dropping to a terminal for

git rm -r --cached path_to_my_folder/

I couldn’t see a menu option, context menu option, or command palette shortcut to let me do the same thing

1 Like

#2

Hi @mrsean2k,

Thank you for using Sublime Merge!

Currently the recommended approach for ignoring files is to directly edit the .gitignore file.

As for the combined ignore + remove, I’d suggest filing a feature request on our issue tracker if you’re interested in having the ability to do this directly in Sublime Merge :slight_smile:
Here’s a related issue: https://github.com/sublimehq/sublime_merge/issues/110

For completeness, you can also add custom git commands (that operate on individual files) to menus in Sublime Merge. See: https://www.sublimemerge.com/docs/menus

Thanks,
- Dylan

1 Like

#3

Hi Dylan,

Editing .gitignore is fine - not sure if a custom command could be any faster than just doing that - and untracking a folder is pretty infrequent.

It’s really confirmation that I hadn’t missed something obvious or that there was a way to run arbitrary git commands from the pallette that I wasn’t seeing. Still finding my way around the interface a bit.

I’ll check the links tho, thanks

Sean

0 Likes

#4

To add to @djohnston’s answer about custom git commands:
add this file to Packages/User/File.sublime-menu (in windows this is inside “%appdata%/Sublime Merge/”)

[
    {
        "caption": "Remove from git tracking",
        "command": "git",
        "args": { "argv": ["rm", "-r", "--cached", "$path"] }
    }
]

Now when you right click on a file/folder, you will have a custom context option to remove the file.

0 Likes