3

I have a need to add a few files from a very large project that I'm a coworker on to Git (or some other version control system), so that I can work on them and make commits as I go along. I typically only work on a few (1-2) files at a time, but they are usually scattered in various subdirectories in the project.

Would this be possible (and practical) using Git? As I don't have access and control over the entire project, making a repo out of the entire project is not possible. I'm working on Windows 10.

Magnus
  • 17,157
  • 19
  • 104
  • 189
  • 1
    Is the _very large project_ version controlled? Are you only concerned with version controlling your own changes? – Adam Jan 24 '19 at 20:15
  • 2
    The answer to basically any halfway-reasonable "is it possible" question, and yours would seem to more than qualify, in Git, is "yes." The only question is what exactly you want to have happen, and you haven't really said how your work should interact with whatever else is going in the source directories you're sampling from. – jthill Jan 24 '19 at 20:16
  • Have you heard of the Git Virtual File System? – Robert Jan 24 '19 at 20:20

1 Answers1

4

I'd create a git repo and links to the files in the very large project (VLP).

$ git init ~/source/repos/very-little-project
$ cd ~/source/repos/very-little-project
$ ln ~/Projects/Vlp/MagnusW/FileA.txt FileA.txt
$ ln ~/Projects/Vlp/SomeOther/FileX.txt FileX.txt

You can edit the files in the ~/Vlp or you can edit them in ~/source/repos/vlp. We've hard linked them so they're essentially the same file. You can use git just as normal in your repository.

Experiment with different paths depending on where very large project is stored and you might want to consider if symbolic or hard links are more appropriate for your situation.

Adam
  • 4,180
  • 2
  • 27
  • 31
  • This was kind of the idea I had in mind, but I can't seem to get it to work. I can create the links, add them to my repo and commit. But if I then modify one of the source files, "git status" still says "nothing to commit, working tree clean"... I'm on Windows 10 and I tried both hard and symbolic links. The Very Big Repo is local on the same drive as my Very Small Repo. – Magnus Jan 25 '19 at 15:47
  • Have you tried re-running the Git Bash installer and enabling the symbolic links feature? It isn't enabled by default. – Adam Jan 25 '19 at 17:29
  • @MagnusW on review do you think this answer is worth of an accept? Thanks! – Adam May 16 '19 at 18:14
  • Hmm, I must have missed your previous comment! Will try enabling the symbolic link feature. I ended up just making a repo, edited the original files and manually copied them to the new repo whenever I was about to commit something. Not the best solution but good enough for keeping a separate history of a micro task when it's not possible or desirable to create a repo in the original location. – Magnus May 16 '19 at 19:17