Using `git log` to see what you've worked on

If you are using git to keep track of your changes and/or backup your data to an (off-site) repository, you can use the snippet below to get a little overview of everything you’ve worked on since a certain date:

virtualPage.define {
  pattern = "log:(.+)",
  run = function(afterDate)
    local secondsInAWeek= 7 * 24 * 60 * 60
    local date = string.len(afterDate) == 10 
        and afterDate
        or os.date('%Y-%m-%d', os.time() - secondsInAWeek)

    local args = { 'log', '--name-only', '--after', date }
    local result = shell.run('git', args)
    local result = result .code == 0 and result.stdout or result.stderr

    local outputWithLinks = string.gsub(result, '\n?(.*[.]md)\n', function(path)
        return '[' .. path .. '](' .. path .. ')\n'
    end


    outputWithLinks = string.gsub(outputWithLinks, '\n?(commit.*)\n', function (header)
      return '### ' .. header .. '\n'
    end)

    return outputWithLinks
  end
}

Then, when you visit the virtual page log:2025-10-15 you’ll see all the commits with links to the files since that date. :slight_smile:

It doesn’t do any proper date validation yet, so if you don’t get any output it could be an issue with your virtual page name. Use log:recent to just see the last week.

Example output (removed the links, but will be clickable in your space!):

log:recent

commit 161c4ef24fbb419d0d89bba629412235a0e512fb

Author: Me
Date: Wed Oct 22 17:46:38 2025 +0200

Latest commit messages

CONFIG.md
Extensions/VirtualPages.md

commit 6a18cabd14c2a5ce9a6de57f7cd9966302ad9609

Author: Me
Date: Wed Oct 21 12:42:32 2025 +0200

Fix the floober gabber

Project/Floober/Gabber.md

This helps me find things I’ve been working on, because I usually remember the day I was working on it. I just need to remember to commit on time, but that can could be automated with cron as well.

4 Likes

I just want to say that it’s this type of creativity (as well as other posts in this category) that make SilverBullet so much fun to work on.

2 Likes

Thanks, zef!

I considered asking if someone already made it, then realised it’s quite a small script with space lua. :slight_smile:

Much easier than writing and distributing a plug-in.

The @ivanalejandro0 s plugin “git history” dit It very well but it’s not working any more. Migration to lua must possible but I don’t find time to intent it