6

I know about submodule, but have a weird edge case where I want to avoid keeping a separate directory for the external repository's code.

I have a LaTeX project for my graduate thesis: https://github.com/jklukas/gradthesis

Which uses a style file which I keep in a separate repository (for others to easily use): https://github.com/jklukas/uwthesis

I could include uwthesis as a submodule, but LaTeX only looks for style files in the main directory. There are hacky ways around this in LaTeX, like giving the explicit path when importing the style file, but that just seems ugly.

Currently, I'm just keeping a copy of uwthesis.sty in the gradthesis repo. Would it be possible to configure uwthesis as a remote and be able to push changes there for just this one file?

Alexis Pigeon
  • 7,423
  • 11
  • 39
  • 44
Jeff Klukas
  • 1,259
  • 11
  • 20

2 Answers2

9

You could add your submodule using the normal git submodule mechanics:

git submodule add git://github.com/jklukas/uwthesis.git uwthesis

And then create a symlink from the top-level directory to the appropriate style file:

ln -s uwthesis/uwthesis.sty uwthesis.sty
larsks
  • 277,717
  • 41
  • 399
  • 399
5

If your problem is only

push changes there for just this one file

you can add all files, excluding one, to .gitignore like this:

*
!path/to/explicit.file

and clear your local repo index:

git rm -r --cached .

Then add, commit and push whatever you want.

radistao
  • 14,889
  • 11
  • 66
  • 92
  • Interesting take, although I'd like something a bit more permanent, so that I can make changes to the uwthesis.sty file in the gradthesis repo and regularly check those back in to the uwthesis repo. Using a symlink should let that happen. – Jeff Klukas May 09 '12 at 18:24