HACKER Q&A
📣 ian_hn

How do you keep personal modifications to a public repo private?


When I work on a someone else's public repo I might add a little extra scaffolding around it like:

* Scripts to install/configure any prerequisites for my distro * Scripts to launch a VM/container to work inside * Editor/IDE config files to setup the project's linting/testing etc

It's not useful to anyone else, it should stay on my machine. But I:

* Don't want to change the repos .gitignore * Still want to use source control on these files

Are there any tools out there to help? How do you solve this?


  👤 bwindsor Accepted Answer ✓
If all the stuff you want to ignore is inside another folder, you can create another .gitignore inside that folder containing just * (i.e. ignore everything). Everything including the .gitignore file itself will be ignored.

👤 eternityforest
What about adding .myname-local folder(Or some other name nobody else will use) which is actually a symlink to a separate repo.local folder.

Use a global gitignore to ignore the symlink.

You could even have a script to git clone, make the local dir, and git init it.

Ideally some kind of global convention could be defined for the local folder name, for consistency, reusable tools, and so everyone could know to stay away from it for nonlocal stuff.


👤 coffeebeanHH
Just work in a separate branch, keep it on track with the master branch and just don't push it.