Using git, I would like to be able to keep a certain folder as part of my local project (feature it in branches, etc) yet I don't want this directory getting pushed up to the public git server.
The folder in question has some CLI Java stuff that the project does not need, but I would like to keep in in sync with the branch work that will go live.
Is this possible?
A very short answer is no. Here is why: When your local git branch is pushed to a server, it's pushed as is without any exceptions. As a commit contains files, it would mess up git internally if some files would not be pushed. This kind of selective behaviour is not supported and I guess it'll never be, as most of the time you are using git incorrectly when you need such stuff.
There are, however, many ways:
I would definitly go with 1 because when I need something for the project, then it belongs to the repo, even if it's java cli.
... you can make git ignore them.
... but not have them in the remote repo I can only give you some hints/ideas to thing I never tried, but you will probably end up having different repositories and things might get a little nasty.
I would have a look at (from maybe ok to probably quite messy and a bad idea):
git-repo
, git-subrepo
or similarpre-push
Hook
git push
git-filter-branch
by handAgain: I didn't use either of them and don't know their drawbacks, pitfalls etc. but to me it seems subtrees are by far the best solution from the above.
Most of the rest does seem quite messy to me but at the end of the day the only thing that matters is what works for you.
Ship lousy stuff, but ship.
...be it in Wasabi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With