Reputation: 31206
Is there a single (or multiple) local file(s) in .git
that changes always and with 100% certainty, if and only if a push is pushed to the remote branch and is accepted by the remote branch?
In other words, is there a way to add a post-push
git hook?
I can alias something,
alias git-push="git push && ./deliver.sh"
But that means I have to memorize some additional curly-cue/stutter step at the root loop of my development workflow. After many days/weeks/months, guaranteed I am typing git push && ./deliver.sh
with less cognitive effort, but more keystrokes. Does it ever get faster? No.
In video game terminology, this is the auto-sync with the cloud. Why should my video game workflow be different than my commit work flow? I demand the smoothness in my video games, but not in the domain where the majority of my life is spent? -- But enough motivation. There ought to be an easy (and portable) way to do this.
Upvotes: 1
Views: 70
Reputation: 488063
There is no single file with any such guarantee.
You can get sort of close. If your Git has a remote-tracking name for some branch name, and you use git push
in a way that asks their Git to update that branch name, and they accept this particular update, the value stored in your remote-tracking name will be updated to match.
By the time you get the answer, however, it may be out of date. Suppose you have them update branch xyzzy
, and your remote-tracking information tells you that before you start, it was commit a123456
. Your push asks them to change it to store hash ID b789abc
. You query your Git, using git rev-parse origin/xyzzy
, to see what's in it now, and it is now b789abc
. So your push request, asking them to change their xyzzy
to b789abc
, was successful. But they might have c012345
in it by now, because of a third-party push scheduled right behind yours.
Upvotes: 2