Stack Overflow Asked by Peter von Frosta on November 16, 2021
I’ve developed two small programs, both of which include my_lcd_lib.h
and my_lcd_lib.c
.
To prevent code duplication I moved this "lib" from the include folder in each project to /usr/local/include
. So far, so good.
How could I tell Git to include those files when pushing the repo?
So the repos from Prog1 and Prog2 would have their own copies of the header/source files.
I can imagine three ways:
When pushing the program repo from dev pc to gitlab server, git could include those outside files by some tricks. Maybe need to edit some .git*
files?
I could make a lib-repo for the stuff in /usr/local/include
. I could set up my program repo to load the appropriate files from the lib-repo. Is that what the pipe/cli are meant for?
I could copy the header files from /usr/local/include
to the program repo just before pushing the program repo. This looks very unsexy.
No, you cannot push files outside the repository. Git does not push individual files, it pushes commits. The files have to part of a commit.
Once you've committed those files in your repository, the rough solution is to symlink them into /usr/local/include/
. The better solution is to used a build tool like autoconf
and install them in /usr/local/include
.
Git is not a substitute for a build tool, nor dependency manager, nor installer.
Answered by Schwern on November 16, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP