Home | Catalogue | Robert's Blog
Last Updated: [2023-04-06 Thu 05:48]
This is a cross platform Bash script, but aimed at Windows users who need to create a Symlink in a Git Repo
Latest version: GitHub
Windows is notoriously bad when it comes to git compatibility. Case in point: The inability to create symlinks that git can understand. (Even when using Windows's seldom used symbolic link function by default without going round the houses: Git For Windows wiki article about Symbolic-Links)
To address this, this script has been created to allow you to create a symlink within the local git repo itself and pull it back onto your local machine's filesystem.
To install the script, launch Git Bash and run the following:
mkdir -p $HOME/bin && curl https://raw.githubusercontent.com/roberthawdon/miscellaneous-scripts/master/git-add-symlink/git-add-symlink > $HOME/bin/git-add-symlink && chmod +x $HOME/bin/git-add-symlink
You can test it was installed correctly simply by running git-add-symlink
from the terminal, the following
should be outputted:
Usage: git-add-symlink <src> <dest>
<src> and <dest> are relative to pwd.
You should then be able to run the following:
git-add-symlink foo bar
Where foo
is the source, and bar
is the destination.
You can then commit
and push as normal
(note, you don't need to git add
when only
adding a symlink with this script)
DISCLAIMER: The information provided on this website is generated from my own notes and is provided "as is" and without warranties. Robert Ian Hawdon can not be held responsible for damages caused by following a guide published on this site. This website contains links to other third-party websites. Such links are provided as convienice of the reader. I do not endorce the contents of these third party sites.