Ev Dolzhenko
Ev Dolzhenko

Reputation: 6232

How to make the git-status output show a few latest commit messages?

I just realized it could be pretty handy (gives you better "sense of context" for your commit when you do git commit for example) if git-status output a few latest commit messages instead of a mere Your branch is ahead of ... so that something like this

# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   Gemfile.lock
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       models.html
#       script/rails_ssl
#       spec.txt

looks like this instead

# On branch master
# Your branch is ahead of 'origin/master' by 2 commits:
# z1s4c8 Use Rack::SSL to force SSL, make cookies secure
# a5f7qw Fixed department filter
#
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   Gemfile.lock
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       models.html
#       script/rails_ssl
#       spec.txt

Short googling session didn't turn up anything great.

Upvotes: 0

Views: 678

Answers (2)

knittl
knittl

Reputation: 265231

you can create an alias for log, such as:

git config --global alias.last 'log --oneline --decorate -n5'

Upvotes: 2

Emil Sit
Emil Sit

Reputation: 23542

There is no built-in way to do that in current git, based on an examination of format_tracking_info as of today (see remote.c).

Your best bet might be to send a feature request mail to [email protected].

Upvotes: 0

Related Questions