Skip to content

Instantly share code, notes, and snippets.

@ivanov
Created September 5, 2013 02:49
Show Gist options
  • Save ivanov/6445482 to your computer and use it in GitHub Desktop.
Save ivanov/6445482 to your computer and use it in GitHub Desktop.
prints the recent heads from a remote
#!/bin/bash
# git-recent: prints the recent heads from a remote
#
# Usage:
#
# git recent # recent branches in this repo
# git recent remote_name # recent branches in remote_name
#
# git-recent was written by Paul Ivanov. Please send improvements to @ivanov on
# GitHub/Twitter, or find my email address.
#
RED="\033[0;31m"
NO_COLOR="\033[0m"
if [ "$#" = "0" ]; then
echo -e \ `git for-each-ref --sort=-committerdate refs/heads --format="%(committerdate:short) %(authorname) $RED %(refname:short) $NO_COLOR \n"` | head
else
echo -e \ `git for-each-ref --sort=-committerdate refs/remotes/$1 --format="%(committerdate:short) %(authorname) $RED %(refname:short) $NO_COLOR \n"` | head
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment