Skip to content

Instantly share code, notes, and snippets.

@wilsonsilva
Created May 23, 2024 16:52
Show Gist options
  • Save wilsonsilva/e5845bedb01ef3f88610c5b9a9f78cfe to your computer and use it in GitHub Desktop.
Save wilsonsilva/e5845bedb01ef3f88610c5b9a9f78cfe to your computer and use it in GitHub Desktop.
Change directory (cd) into a local github repository
ghcd() {
if [ -z "$1" ]; then
echo "Usage: ghcd <username/repo>"
else
wd github
folder_name=$(echo "$1" | cut -d "/" -f1)
repo_name=$(echo "$1" | cut -d "/" -f2)
cd "$folder_name/$repo_name"
fi
}
# requires wd and a wd alias called github. Alternatively, replace wd github above with the absolute path of your Github repos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment