I develop some scripts for handling my bibtex-databases and PDFs.
For convenience, I manage both the database and the scripts in the same git repository (a thing I do not want to change). However, I would like to make my scripts available (e.g. on github) but not my database or pdfs. Still, I want to have the same commit-history both on github and locally for the scripts.
I thought about having a github-branch and to push only this branch. But how would I update the branch with the commits done to the scripts in the master branch?
Are there any other ways to do this?
By default, git push only updates the corresponding branch on the remote. So, if you are checked out to the main branch when you execute git push , then only the main branch will be updated. It's always a good idea to use git status to see what branch you are on before pushing to the remote.
You could use git subtree
to split off the scripts directory into their own branch (with complete history for that subdirectory) which you can then push to GitHub. You can run git subtree again to keep the split repository up to date.
To give an example, once you've installed git subtree
you can do:
git subtree split --prefix script-directory --branch just-scripts
git push github-scripts just-scripts:master
... assuming that your scripts are in script-directory
, and github-scripts
is a remote that points to the URL of your GitHub repository intended for just the scripts.
But how would I update the branch with the commits done to the scripts in the master branch?
Cherry-pick the commits pertaining to the scripts from master
into the public branch. Or, edit the scripts in their own branch, then merge the changes into master
when you need them.
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