things to keep

diverting content of a developers life

gc - another shell alias

2022-12-24 1 min read dev ckroeger

Wouldn’t it be nice to have a alias for cloning a git repo and change to cloned directory?

Here it is:

# clones git and change to new dir
alias gc='_gc(){ git clone $1 && cd `echo "$1" \
  | sed -E "s|.*/([a-zA-Z0-9\\-]+)\.git|\1|"`; }; _gc'

Usage:

$ gc <CLONE-URL>