Updating a Gist or file using API is much faster (almost 3 times) than git-push
Git-push takes a lot of work figuring out what files need to be pushed. The local copy also needs to query upstream about its current state before it can decide whether a pull is necessary before push.
A local commit, on the other hand, takes almost no work compared to git-push.
Because Gist / file update using the REST API is nothing but a file-ransfer over https + a local commit@upstream, it is supposed to be faster than git-push.
Git-fetch doesn't care about the state of the local repo. It's only job is to update the local remote-tracking branch. Hence it is much less involved compared to git-push. In addition, most ISPs provide more download speed than upload. Therefore, git-fetch is always much faster than git-push.
However, there might not be any real benefit in downloading a file using github-API and curl
instead of git-fetch. Rather, git-fetch would undoubtedly be faster in case multiple commits need to be downloaded, because of the compression (packfile) done by git-fetch. Also, keep in mind that git:// is faster than https://.
So the ideal recipe for speed is:
- If only one file need to be changed per push, then push using API.
- Fetch using git-fetch. Use git:// in the fetch-url, if possible.