Say I've got the following directory structure:

   |__A -> root/A

Where root/B contains a symlink to root/A. I want to keep everything about A the same except for one or two files which I'd like to replace. I know this may be a job for Git, but being forced to constantly rebase B's submodule's branch, or switching branches in a symlinked repo seems obnoxious. Also, because these are golang services, fetching branches other than the default / master branch with the package manager is a pain too.

  • 3
    X != Y. If you have a problem you want to (find ways to) solve, concentrate on presenting the problem. If you have a tool whose technical features you want to learn about, concentrate on the tool. Now, you mention symlinks, and some soft of a problem statement, but I can't tell which one is the actual point of the question. You might want to edit the question to clarify.
    – ilkkachu
    Commented Jan 2, 2018 at 13:52

1 Answer 1


I agree with @ilkkachu you may see the problem in the wrong direction or not provide here the relevant information, for people to really help you.

I am not sure to understand your question, but about git specifically and branches, have a look at worktrees it may help or not in your case: https://git-scm.com/docs/git-worktree

Also, modern Linux versions have an overlay filesystem where can put stack mount points on top of each other and see the resulting union of files, while deciding where do the write go. This is very much useful for snapshots and virtual machines. See these two links:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .