tags:

views:

22

answers:

2

I'm using one file from a git repository off of github in a project living in my own repository. As it is right now whenever a new version of the file on github is created I have to manually download it and commit it to my repository. Is there a way to automatically keep it in sync with the remote repository whenever I pull new changes to mine?

I know this has the potential to break my code, but I'd much rather go back and fix some of my code and use the latest version. It will be easy for me to see what breaks as I have pretty good test coverage.

A: 

Take a look at git submodules.

git help submodule
Roman Cheplyaka
+1  A: 

I don't know of any way to do this for a single file. If you can keep the stuff from the third-party repository in its own subdirectory, you could either use submodules or a subtree merge strategy. Sections 6.6, for submodules, and 6.7, for subtree merges, of Pro Git also deal with this extensively. For working with subtree merges, Avery Pennarun's git-subtree command may come in handy.

earl
Awesome! I was able to get the individual file into my repository using a symlink (The symlink is part of my repository, but the original file lives on in a submodule). Thanks for the help!
TrueDuality