Skip to content

Instantly share code, notes, and snippets.

@KingScooty
Created November 8, 2012 12:06
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KingScooty/4038411 to your computer and use it in GitHub Desktop.
Save KingScooty/4038411 to your computer and use it in GitHub Desktop.
Symlinking a folder from a git submodule for use in a project

#Symlink a folder from a git submodule for use in a project

I recently came across a need to try this out on a project i was working on. So here's how to do it, incase anyone else finds themselves in the same situation.

##Set up your submodule in a seperate directory.

Run this command from your project root.

git submodule add http://example.com/repo.git ./submodules/repo

##Create a symlink to the subfolder in the place you want: ln -s ./submodules/repo/subdirectory ./wherever/symlinked_directory

@2LeoCode
Copy link

2LeoCode commented Jun 8, 2021

When You update the submodule the symlink gets destroyed

@xparq
Copy link

xparq commented May 27, 2023

@2LeoCode, does it? Not just when ./submodules/repo/subdirectory itself gets wiped out by an update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment