From dcacddc27f3efd2fc6af812836b4b96f69018364 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 9 Aug 2018 11:19:22 +0100 Subject: [PATCH] Add git checkout-last alias --- README.md | 2 ++ config | 1 + 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index 6bcb68b..da899e9 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ than remember the plumbing term of a specific command. * `delete` deletes an existing branch, shorthand for `git branch -D`. * `name` the name of the current branch. * `last` the name of the last branch checked out before the current branch. +* `checkout-last` checkout the last branch, shorthand for + `git checkout $(git last)`. * `publish` push and set the tracking branch of a local branch to origin, shorthand for `git push -u origin `. * `unpublish` delete a remote branch, shorthand for `git push origin :`. diff --git a/config b/config index 8628cbb..b33ee51 100644 --- a/config +++ b/config @@ -11,6 +11,7 @@ delete = branch -D name = rev-parse --abbrev-ref HEAD last = !sh -c 'git reflog | grep \" checkout: moving from\" | head -n 1 | awk \"{ print \\$6 }\"' + checkout-last = !git checkout `git last` publish = !git push -u origin `git name` unpublish = !git push -u origin :`git name`