Marcello Miorelli
Marcello Miorelli

Reputation: 3698

how to link the same script in different folders in git, and keep them synchronized?

I am in the process of migrating from visual source un-safe (VSS) to Git.

One of the good features of VSS is that you can put the same script in different folders, and when you check it out it updates the script in all the folders you have placed it.

if there a way to achieve the same thing using Git? TIA M

Upvotes: 0

Views: 60

Answers (1)

Magnus Bäck
Magnus Bäck

Reputation: 11581

Git itself has no such mirroring feature for files within a project. I see two possible solutions:

  • If your file system supports symbolic links or something equivalent that would be one way of solving it. I guess reasonably recent versions of Windows support symlinks but I don't know how Git deals with them (probably also depends on whether you run msysgit or cygwin's Git). See Git Symlinks in Windows.
  • You can write a post-checkout hook for Git that copies files after a new commit is checked out. It should be fairly easy.

That said, I consider said VSS feature a gross misfeature that I think you should try to get away from instead of mimic with Git.

If you want to share files between projects you can look into submodules.

See also Why do Version Control Systems lack the sharing functionallity of Visual Source Safe and what source control do you use and reckon is worth trying out?.

Upvotes: 3

Related Questions