Git Integration

A simple lightweight visual UI for git integration. Ideally this could behave similar to VS Code’s git integration (show which files are new or edited since the last commit), a UI for staging changes, a UI for committing changes, and a UI for pushing/pulling.

I think a totally acceptable MVP of the Plugin could have no branch support and no merge/merge-conflict resolution support.

For the most part, such a plugin would need:

  • A small custom UI pane (for stashing, committing, pulling, etc).
  • A method for styling listings in the note directory pane.
  • A method for changing plugin settings.
  • Some way of interacting with the shell / external environment.
  • Ideally, some kind of file listeners.
25 Likes

We should go one step further and make it really easy for non-programmers to use git, i.e even better UI than Visual Studio Code.

4 Likes

I think it’s worth calling out the use cases for git as separate needs:

  1. git with a remote for synchronization
  2. Periodic git commits for version history
  3. git branches for diverging notes
  4. …?

I believe 1. and 2. are planned to be handled by the upcoming “Obsidian Sync”? Although, a third-party plugin that lets users roll their own sync/history with git would be rad.

I’m not sure what the exact use case for 3. is, but core support for an undo tree might be super powerful.

5 Likes

Any inspiring use cases off the top of your head for non-programmer to get excited :slight_smile:

  • Make git project (assume you have gitlab/github credentials), or then local file.
  • add
  • commit
  • update (many work on the file)
  • revert to previous version
  • revert to version May 20 2020

Branches and rebasing will just confuse end users *). The biggest benefit, really, me thinks, is group work. For individual file editing, it’s overkill and just saving backups of files work fine.

*) if someone needs this, they know how to use the command line tool or various GUI tools, or then the web interfaces from gitlab/github.

I think git based file versions should be great useful.
We should keep one commit contains only one file, so that one commit is one version for a file.

For single user, a GUI can help me to squash unnecessary commits when there are too many versions and I just want to pick a few to keep. We can have a writing branch with only new commits for last 3 month, and a master branch with only pick versions. And force push is allowed to keep the repo small.

And the history view on this forum is quite good, which seems what I need upon git commits.

I agree this would be a great feature to add. I think even if there are no GUI options for doing add/commit, just highlighting files/lines are currently modified/added/removed with green/yellow/red would be great start.

2 Likes

Such a plugin should also track rename/move/delete operations in Obsidian and use the proper git commands for these operations instead of doing these operations on the file system only.

I think GitJournal developer is working on these features. It’s a Markdown + YAML + [[WikiLinks]] mobile app editor that can sync with Obsidian through GitHub / GitLab.

As for making it easy for non-programmers (like meself) to use Git, he’s working on easy How to Setup guides. He’s also planning a desktop app for much better integration and sync with multiple repos. He’s very approachable on Discord and open to feature request ideas.

It seems to me that Obsidian and GitJournal would synergize pretty well =)

Also, Bryan Jenks recently wrote this very interesting article: How I Put My Mind under Version Control
@tallguyjenks

2 Likes

I think one inspiring use case could be the ability to see how your project has progressed over weeks, months and years. What I really like about version control (i.e. Git as is the topic here) is that I can open a file and see line by line (and even word by word) when I have last edited them. I do not necessarily need that information for anything, but it’s just so nice to look at :). And it might give you some reference if you wonder “in which situation did I come up with this idea?” - and then you will see the date when you wrote a certain sentence is dated lets say two years ago and you start to remember what kind of things you were working on back then.

Sorry, maybe I got a little distracted there :D. I’ll link an image here that I found from the internet just to demontrate a Git annotation feature that I would like to see in Obsidian:


This is from IntelliJ IDEA programming editor (or some other Jetbrains editor). While it does not happen to have a markdown file open, but some Java code instead, I think it shows the idea pretty nicely: on the left side there is a panel showing dates when each line was last changed (could show time too if wanted). It even shows who changed the lines (not so important for solo projects, but very helpful for groups that edit the same files). And when you don’t need it, you can hide it.

Intellij IDEA also allows you to check what a specific line looked like before it was last changed. I think it’s a really decent Git integration and while Obsidian does not need to implement all of it, it’s a nice source of ideas.

I’d love to see this, especially for version history - its far more likely that GIt will exist indefinitely than Obsidian, and I think I’ve also heard that Obsidian Version History only stores 1 rolling year of versions.