Automated push "build branch" after using "git archive" without local repo
I am setting up a aut开发者_StackOverflow社区omated build on top of a git repository. I want to automatically build versions from the master branch -- I'm using "git archive" to a build sandbox -- and, depending whether the build succeeds, I want to push a "build branch" to the version that succeeded building.
The idea is that the "build" branch will always be reachable from master, that is, it will always be a fast-forward from "build" to "master", so I'm not creating any objects, not even commit objects, I'm just moving a "ref" from one already-existing to another already-existing commit object.
The reason I'm using git archive is to have the attributes "export-ignore" and "export-subst" properly applied when building.
So, summarizing the question:
Is there a way to update a ref in a remote git repository -- to a commit that is already on the remote side -- without having a clone of it?
daniel
You will already have a clone of it where you are building. A simple push of HEAD:master is all you need. Also consider tagging instead to mark your successful builds.
UPDATE:
Git is something that will always need to send objects when you push something to a remote. If you don't have the objects you can't push. That said, you could automate via a drop to a shared dir the SHA1 of the commit and have a process on that other machine with a clone of the repo push that reference into the branch.
Hopefully there are some low level commands that can do this directly, or a way to trick it, but I haven't seen that yet.
精彩评论