My question is quite simple, however I don't find any answer on StackOverflow or elsewhere (except this question but without being answered):
Does anyone know a way to commit a GIT change "directly" to a remote repository (Github in my case) without cloning the repository in local and having to commit first to local repository then pushing to remote?
Commits will be performed programmatically from Python (by using simply GIT command lines). Honestly I don't see the advantage (in my case) of having a separate server (for local repos) and keep huge git repository on it just to push them finally to Github.
You can clone the repo with -n to not checkout any files.
--depth 1 will truncate the history of each file to their last commit
git clone -n git://path/to/repo.git --depth 1
cd repo
Checkout only the files you need to change for your commit
git checkout HEAD file.ext
Just be careful to only commit the file you're working on. If you do something like git add . you will be committing the deletion of all files you have not checked out!
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