Get git tail hashes from your repository in reverse chronological order
It sucks when you could do git show HEAD
but not git show TAIL
. git-tails
comes to the rescue!
Did you know that there could be more than one tails in your git repository?
$ npm install --save git-tails
var gitTails = require('git-tails');
gitTails(function(err, data) {
console.log(data);
//=> ['0cd33254f2df29272323dca4f052be70d9659174']
});
gitTails.sync()
//=> ['0cd33254f2df29272323dca4f052be70d9659174']
$ npm install --global git-tails
$ git-tails
0cd33254f2df29272323dca4f052be70d9659174
To get the earliest tail you just need to do
gitTails(function(err, data) {
console.log(data[data.length - 1]);
//=> '0cd33254f2df29272323dca4f052be70d9659174'
});
If you know there is only one tails you could do
$ git show `git-tails`
Just like git show HEAD
.
MIT © Steve Mao