Auto-alias Your Repos
Kyle Nickel
Posted on January 25, 2020
If you have all your code repos under a common directory, you can make it so changing your working directory to any of the repos is just entering the name of the repo.
For example, all my code repos are under ~/code
:
~ > ls ~/code
bar foo
By adding a loop for the sub-directories of the common parent inside your shell config, ~/.zshrc
in my case, you can automatically create a alias for each of the repo directories:
for repo in $(ls ~/code)
do
alias $repo="cd ~/code/$repo"
done
Then you need to reload your config:
~ > . ~/.zshrc
Now, if you're in one repo, lets say foo
:
~/code/foo/app/models >
You can easily swap over to bar:
~/code/foo/app/models > bar
~/code/bar >
💖 💪 🙅 🚩
Kyle Nickel
Posted on January 25, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.