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";