Press enter after choosing selection

Git Alias for Log and Status

Mon, 09/08/2014 - 11:05am by ejk

I found that I often was doing a "git log" plus a "git status" when visiting a repository I hadn't touched in a while, just to get a lay of the land. Here's a quick alias I whipped up for git that combines the two, giving you a peek at how recently the repository has commits and also if there are any uncommitted changes lurking around.

Here's an example of the output:

$ git logstat == LOG =========== d5e8186 ejk 2014-08-31 Add badge check for all players function 9c3d1e5 ejk 2014-08-04 Correct default end date on game code form if left blank 1f48884 ejk 2014-07-20 Add curly brackets to badge formula description == STATUS ======== # On branch master # Untracked files: # (use "git add ..." to include in what will be committed) # # ._.DS_Store # pdf/._adult_game.pdf # pdf/._adult_game_1.pdf # pdf/._adult_game_2.pdf # pdf/._sg2014_adult.pdf nothing added to commit but untracked files present (use "git add" to track)

Create the alias from a shell prompt:

$ git config --global alias.logstat 'echo "== LOG ===========" && git log --date=short --pretty=format:"%h %an %ad %s" -n 3 && echo "== STATUS ========" && git status'

Or create the alias in your .gitconfig:

[alias] logstat = "!echo \"== LOG ===========\" && git log --date=short --pretty=format:\"%h %an %ad %s\" -n 3 && echo \"== STATUS ========\" && git status"

More about git aliases: Aliases

Graphic for blog posts

Blog Post