denolehov / obsidian-git

Backup your Obsidian.md vault with git
MIT License
6.15k stars 252 forks source link

Support for rename of files #579

Closed BaumiCoder closed 10 months ago

BaumiCoder commented 10 months ago

Feature description

If I rename a note (or a file in general) in obsidian, it should be also renamed in git (git mv).

Use case for the feature

I want to rename one of my notes in obsidian. If there are many other notes with links to this note, I change the name directly in obsidian to update all links to the new name. The renamed note should be also rename in git, so that the history of the file doesn't get lost.

Actual workaround

Actual I have to do a workaround like this to achieve it:

  1. Rename the note in obsidian, to update the links.
  2. Rename it back to the old name outside of obsidian, with file explorer or on the shell.
  3. Make an git mv on the note.

Further ideas for the feature

Vinzent03 commented 10 months ago

You just have to stage the files. Git will identify the rename and properly mark it as a rename. Duplicate of #62

BaumiCoder commented 10 months ago

Thanks for the quick response.

I expect that a command like git log renamedNote.md also shows the commits to the file before the rename (like in SVN). That isn't the case. But now I looked at it in detail. That's the normal behaviour. Using git mv doesn't make it better. EDIT: --follow must be given as an option to achieve it.