Is it possible that git is tracking one file from an external repo?

I know about the submodule, but I have a strange extreme case when I want to avoid saving a separate directory for the external code of the repository.

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

Uses a style file that I keep in a separate repository (for others you can easily use it): https://github.com/jklukas/uwthesis

I could include uwthesis as a submodule, but LaTeX is looking for style files in the main directory. LaTeX has hacking methods, such as providing an explicit path when importing a style file, but it just seems ugly.

I am currently saving a copy of uwthesis.sty in the gradthesis repository. Is it possible to configure uwthesis as remote and be able to make changes there only for this one file?

+4
source share
2 answers

You can add your submodule using the usual git submodule 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 
+7
source

If your problem is only

click here changes for this file only

you can add all but one of the files to .gitignore as follows:

 * !path/to/explicit.file 

and clear the local repo index:

 git rm -r --cached . 

Then add, lock and click what you want.

+4
source

Source: https://habr.com/ru/post/1411355/


All Articles