17

I recommend to look into git log --help and git rev-list --help .

I just created 2 scripts to list commits from Git repositories. It's more in the score of an alias actually, so nothing comprehensive here. If you have some one-liners, alias or scripts for commits listing, please share here. The link of this post goes to the git log documentation. I'll share mine in the comments too rather than in the post.

you are viewing a single comment's thread
view the rest of the comments
[-] thingsiplay@lemmy.ml 1 points 1 week ago* (last edited 1 week ago)

https://gist.github.com/thingsiplay/9ad7df1d743a5dafa4bef489801503f6

gitlog:

#!/usr/bin/env bash

# List Git log messages by tag or commit range. Defaults to HEAD.
#   gitlog [from] [to]
#
# from and to can be a tag or commit id:
#   gitlog v1.22.2
#   gitlog 281b532
#   gitlog 281b532 b0353a6

from="HEAD"
to="HEAD"
if [[ $# -ge 1 ]]; then
    from="${1-HEAD}"
    shift
fi
if [[ $# -ge 2 ]]; then
    to="${1-HEAD}"
    shift
fi
format="(%cr) %s"
git --no-pager \
    log \
    --oneline \
    --decorate=no \
    --date=short \
    --abbrev-commit \
    --pretty=tformat:"${format}" \
    "${from}^..${to}^" \
    origin/master "${@}"

gitlogdate:

#!/usr/bin/env bash

# List Git log messages since date. Defaults to today.
#   gitlog [date]
#
# date can be a specific date %yyyy-%mm-%dd or description:
#   gitlogdate 2026-11-03
#   gitlogdate yesterday
#   gitlogdate 3 weeks ago

date="today"
if [[ $# -gt 0 ]]; then
    date="${*-today}"
fi
format="%h %ad %s"
git --no-pager \
    log \
    --oneline \
    --decorate=no \
    --date=short \
    --abbrev-commit \
    --pretty=tformat:"${format}" \
    --since-as-filter="${date}" \
    origin/master
this post was submitted on 05 Nov 2026
17 points (94.7% liked)

Programming

29306 readers
493 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS