Using Symbolic Link
#post
This post originally appeared on Blog 2.0
Alias are great in that they allow you to navigate to a folder elsewhere. However, aliases break when you try to use it with a terminal or anything power-user-ish.
Symbolic links (aka symlink or soft link) solve this by creating references to another path in a way that affects pathname resolution.
H2 Implementation
To create a symbolic link on mac, do this:
ln -s /original/path /linked/path
It’s probably the same on Linux
H2 Use case
Let’s say you put a git repository on iCloud Drive (also applies to OneDrive, etc.). That wouldn’t be a good idea as iCloud now syncs all the files in the .git
folder.
To stop iCloud from syncing .git
, we can rename it to .git.tmp
or .git.nosync
, but this breaks git (duh).
What we can do, therefore, is to create a symbolic link to .git.tmp
from the proper name .git
.
ln -s .git.tmp .git
Now that .git
points to .git.tmp
but doesn’t contain files itself. Problem solved
References