Created
September 14, 2012 15:20
-
-
Save pivotal-casebook/3722584 to your computer and use it in GitHub Desktop.
A shell script which outputs all git branches on origin, sorted by the most recent commit, and shows authors of those commits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
metropolitan:casebook2 (master) $ script/show-branch-info | |
Pruning origin | |
URL: [email protected]:casebook/casebook2.git | |
* [pruned] origin/old_branch_1 | |
* [pruned] origin/old_branch_2 | |
2012-09-14 11:09:29 -0400 12 minutes ago John Doe origin/master | |
2012-09-14 11:09:29 -0400 12 minutes ago John Doe origin/HEAD | |
2012-09-14 09:48:47 -0400 2 hours ago Jane Doe origin/topic_branch_1 | |
2012-09-14 09:48:14 -0400 2 hours ago Jimmy Doe origin/production_branch | |
2012-09-13 18:36:23 -0400 17 hours ago Jack Doe origin/topic_branch_2 | |
If you're unable to remove a branch, it may already be gone from the remote. Try git remote prune origin (git remote prune --dry-run origin) to see what remote branch references will be deleted | |
metropolitan:casebook2 (master) $ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
git remote prune origin | |
for k in `git branch -r|awk '{print $1}'`;do echo `git show --pretty=format:"%Cgreen%ci %Cblue%cr %Cred%cn %Creset" $k|head -n 1`\\t$k;done|sort -r | |
echo "If you're unable to remove a branch, it may already be gone from the remote. Try git remote prune origin (git remote prune --dry-run origin) to see what remote branch references will be deleted" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment