Created
May 24, 2011 03:02
-
-
Save matthewmccullough/988077 to your computer and use it in GitHub Desktop.
Visualize Git Orphans via gitk and log
This file contains 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
# Put this in your .gitconfig file under the alias section | |
orphank = !gitk --all `git reflog | cut -c1-7`& | |
# Then run it by typing 'git orphank' on the command line. | |
# A text version of the same is | |
orphanl = !git --pretty=oneline --abbrev-commit --graph --decorate `git reflog | cut -c1-7` |
This file contains 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
* a17bf55 (HEAD, master) Placeholder | |
* 8d2636d (origin/master, origin/HEAD) Added text about image diff example | |
| * 7c0ffa9 (origin/feature_image, feature_image) Made changes to an image to sh | |
| * 7c1bf73 Created an image to be used for web image diffing on GitHub | |
|/ | |
| * d5f4cdc Made changes to an image to show GitHub web image diffing. | |
| * 2a354dd Created an image to be used for web image diffing on GitHub | |
| | * e9eb5b9 Made changes to an image to show GitHub web image diffing. | |
| | * 417a71b Created an image to be used for web image diffing on GitHub | |
| | | * 9648459 Made changes to an image to show GitHub web image diffing. | |
| | | | * 1aad461 Changes to image | |
| | | |/ | |
| | | * b5e6eb5 Created an image to be used for web image diffing on GitHub | |
| | | | * 6dc1b97 Image 1 | |
| | | |/ | |
| | | | * 9915b4e Changes to image | |
| | | | * e64fb9d Image 1 | |
| | | | * 9a53b8e Good change from mattaltego | |
| | | | * 2961fee Revert "Main feature" | |
| | | |/ | |
| | | | * d7b2900 Changes to image | |
| | | | * 949320c Image 1 | |
| | | | * 3462650 Merge branch 'master' of github.com:matthewmccullough/hellog |
Rather than passing the git reflog
output through cut
, an even easier solution is to just use git reflog --format=format:%h
:
orphank = !gitk --all $(git reflog --format=format:%h)
@living180 Thank you very much.
You saved my life.
Nice command.
Why not use the even shorter gitk --reflog
?
@herrmanthegerman thanks! I didn't know it exists.
It is not even on the gitk man page:
https://git-scm.com/docs/gitk/
so IMHO it is normal nobody know a command if there are no documentation about it.
Thank you very much!
@mercuriete The gitk man page you linked to does mention this
To control which revisions to show, gitk supports most options applicable to the git rev-list command.
And the git rev-list
man page documents --reflog
and many other options.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
orphanl command should be:
The single quotes are needed to pass through git unscathed (rather than double quotes). It looks like the backticks were dropped by the markdown editor in the previous post - added back here.