Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request]: git log and show commit changes #472

Closed
mkczyk opened this issue Mar 19, 2023 · 8 comments
Closed

[Feature request]: git log and show commit changes #472

mkczyk opened this issue Mar 19, 2023 · 8 comments

Comments

@mkczyk
Copy link

mkczyk commented Mar 19, 2023

I would like to see possibility of of seeing what has been committed last time.

User story

  • [Current behavior] You have changes:

image

  • [Current behavior] Commit this. Changes in window disappeared.
  • [New] Click new icon "Commits".
  • [New] It opens list of last commits. For example last 10 commits. (Extended feature: number of commits configurable in settings or by click button "Load more" at bottom of list.)

image

  • [New / Current behavior] When click on commit name it shows commit changes (the same as it is now in current "Changes", but this from specified commit).

image

Motivation

I have installed Obsidian Git and set:

  • "Vault backup interval (minutes)": 10
  • "Auto backup after file change": on

And I have synchronization via Dropbox (for syncing desktop and mobile - Android app).

On mobile I disabled Obsidian git (due to restrictions/performance).

My workflow is:

  • Write notes on mobile.
  • Automatically sync via Dropbox.
  • Open Obsidian on desktop.
  • After opening Obsidian on desktop it commits immediately (due to setting "Auto backup after file change").

It works like a charm.

But then I would like to see what I just committed - what files I added/edited on mobile - usually I need to tidy/read them on desktop.

Workaround

Of course you can open console and type: git log or gitk to see what changes was made:

image

But you have to manually open folder with vault, open console, type command.

To speed up this flow you can install two plugins:

  • Shell Command
  • Commander

In Shell Command add "gitk" command:

image

In Commander add icon to added command:

image

Now you can easily click one icon which opens gitk and you can see commits:

image

It works good.

But it would be nice if I can see Changes in Obsidian Git in the same way as current changes. With this feature you could quickly open notes from last commits just by clicking on icon "Open file" (like now from "Changes"):

image

@Vinzent03
Copy link
Owner

I suggest you the Version History Diff plugin. I shows the history per file. Or do you really want to see the changes per commit?

@mkczyk
Copy link
Author

mkczyk commented Mar 19, 2023

Thanks for suggest plugin. It have nice command "Version history diff: Show Diff view for active file". But with this you can only see changes in one selected file:

(I see also command "Obsidian Git: Open file history on GitHub" which is similar - but of course on GiHub instead of locally).

But if you don't know what files changes you can't use it (see my use case in "Motivation": add note on mobile, after some days and synchronization open Obsidian on desktop - you don't know which file to open).

I found another workaround:

Workaround 2

Plugin Templater: #334 (comment).

Result with command gitlog: git log --pretty=format:'%s' -5 and code from link above:

image

Result with new command gitshow: git log --name-status --pretty=format:'%s' -1 (and code as before with replaced command):

<%_* 
const msgs = await tp.user.gitshow()
const array = msgs.split("\n")
await tp.system.suggester(array,array)
tR += tp.file.selection();
_%>

image

Now you have list of files from last commit. It nice, but I should extend it more (if it possible with Templater):

  • select commit instead of just present changes from last commit (open first dialog, select commit, and pass selected commit as parameter to second dialog),
  • select file, press enter, open this file.

If these extension are possible with Templater it would be nice workaroud for the feature request.

But still Obsidian Git "Changes" window is really nice and reusing it for commits changes seems like the best, natural solution.

@Vinzent03
Copy link
Owner

Available in new release. Use a command to show the history view.

@mkczyk
Copy link
Author

mkczyk commented Mar 22, 2023

Thank you. It is awesome!

image

@joellti
Copy link

joellti commented Mar 25, 2023

I like this new feature a lot, but it only shows history globally. I would like to be given option to see the History view of the current active file, if it's all possible. Hope it can be considered. Thanks in advance.

@tamiroh
Copy link
Contributor

tamiroh commented Mar 25, 2023

@joellti
I tried to implement the feature in the past (#463), but the Version History Diff plugin has almost the same functionality, so I started using it. It is good and easy to use.

@joellti
Copy link

joellti commented Mar 25, 2023

Thx for the hint. I tried Version History Diff plugin before but it had a limitation with handling files renamed/moved. I tried it again with latest version and that limit is also addressed so it's perfect for my need now. Thanks again.

@jimpfaff
Copy link

I can go into Git and find the logs. That's simple. What I'd like to see is a record of the error messages or other notifications that come up from time to time. Those aren't always in the logs as far as I can tell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants