From 6b4606ac84208621be19c546db506e650bb95ac4 Mon Sep 17 00:00:00 2001 From: Simon Walker Date: Fri, 25 Aug 2023 21:10:18 +0100 Subject: [PATCH] Add checkout helper script --- home/bin/git-co | 10 ++++++++++ home/git.nix | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 home/bin/git-co diff --git a/home/bin/git-co b/home/bin/git-co new file mode 100755 index 00000000..0f78eb16 --- /dev/null +++ b/home/bin/git-co @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if [[ $# -eq 0 ]]; then + BRANCH=$(git branch --format "%(refname:short)" | fzf --exit-0) + git checkout $BRANCH +else + git checkout $* +fi diff --git a/home/git.nix b/home/git.nix index 6d57f9da..6be76ed0 100644 --- a/home/git.nix +++ b/home/git.nix @@ -42,7 +42,6 @@ # Other aliases ff = "!f() { git merge --ff-only origin/$(git branch-name); }; f"; st = "status"; - co = "checkout"; su = "submodule update --init --recursive"; pr = "pull --rebase --prune"; mergeff = "merge --ff-only";