|
|
|
|
|
by garaetjjte
3589 days ago
|
|
Only a bit of awk magic: ~/git-undo.awk: BEGIN { jmp = 0 }
{
match($2, "{([0-9]+)}", c);
if (c[1] == jmp)
{
jmp++;
if ($3 == "reset:")
{
match($6, "{([0-9]+)}", x);
jmp += x[1];
}
else
i--;
if (i == 0)
{
print jmp;
exit;
}
}
}
git config --global alias.undo '!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{$(git reflog | awk -v i=${1-1} -f ~/git-undo.awk)}; }; f'
Redo is also possible, but i don't have time now to do it. |
|