Sublime Forum

Sublime Merge - Rename files/folders


How do I go about renaming a file or folder through sublime merge? I know I can do it with git bash or something else, but I’d like to try and learn how to do everything through sublime merge.



Remember that Git doesn’t track renames, it just infers them on an as-needed basis. Sublime Merge works the same way.

The general process is to rename the file as you normally would (e.g., through Explorer, Finder or a terminal). Sublime Merge will now show a deleted file (the old name) and an untracked file (the new name). Stage both of these, and Sublime Merge will detect that a rename has occurred, and show a renamed file under Staged Files. Note that this in exactly the same workflow as using git from the terminal.

There is a ‘git mv old_name new_name’ command via the terminal, but that’s just an alias for doing the above: renaming the file, and then staging the old and new names. I imagine we’ll add a Command Palette equivalent for doing this, but it’s not there right now.



Is it possible to collapse the two different stage commands into one “stage rename”? For first time users, the implied behaviour is that when I stage the delete and stage the add it will look like that in the history (thus losing the previous history of the renamed file).

I was reverting to the console each time because I just assumed Sublime Merge didn’t track renames at all :slight_smile: