Git: /.git/hooks/post-commit to push to origin repo on commit

Some applications - such as gitg - make available LOCAL commits & branch management, but have no provision for PUSHING to the remote origin.

Luckly, git leverages 'hooks' that provide a means to add shell scripts for such a need.

Once a commit is done on a branch, git will call "/.git/hooks/post-commit" and - if present - will run the contained shell script.


#!/bin/bash

#
# post-commit web hook
#
#git push -u origin develop
git push -u origin ffsync-setup

#
# set this file to executable
#
# chmod 755 post-commit
#

this code block will push the ffsync-setup branch to the remote origin

 

Tags