Is there a way to push a commit to a remote git repo, without first making a local clone of that repo?
I have a valid URL for the remote repo, I know the path of the file, and all I want to do is push an updated version of the file onto the master. Ideally I'd like this to work with any valid remote repo URL, but it would still be helpful if it worked only with https-based git URLs.
I'm guessing this is impossible, since it does not seem to be possible even to retrieve a single file without cloning in the general case, according to the answer How to "git show" on a remote repo? . But I'm hoping there's a workaround that uses some of the lower level git commands.
The man pages says though: you cannot clone or fetch from it, nor push from nor into it. So even though you could use this to create a patch and send the patch individually, it won't help you with pushing changes automatically. @Shahbaz, done.
Impossible. But since a prospective commit would just need to have one single commit as its parent it's possible to employ the so-called "shallow cloning" and fetch just the tip commit of the branch you need. This will bring only a minimum amount of objects from the remote. Look for the --depth
command-line option of git clone
.
Yes you can push a new version using tagging
follow this steps
in your new project root
git init
git remote add origin [email protected]:yourusername/yourpoject
git tag -a v2.0 -m 'version 2.0'
git add .
git commit -m "New Version 2.0 :rocket:"
git push -u origin v2.0
now you have a new branch called v2.0 with your new project and your master branch stays untouched. After that if you wan't you can change your default branch in your github project settings.
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