git-pushed is a command line tool to get last modified heads from remote git repository.
$ git-pushed https://github.com/PauloASilva/node-http-mitm-proxy.git
git-pushed keeps track of remote repository heads in
On first run, because there's no cache, all heads will be reported as they had been changed.
Gitlab fires a jenkins job on push events. jenkins job runs commands over SSH on a remote machine which should checkout the repository, in which the push event occured, if and only if push was done on a specific head.
ssh user@remote-machine<<<EOF status=$(git-pushed email@example.com/project.git | grep "ref/heads/development") if [ "$status" -ne 0 ]; then echo "Nothing to do!" exit 0 fi git checkout firstname.lastname@example.org/project.git -b development # some other remote commands # ... EOF
- Git checkout
$ cd /tmp $ git checkout https://github.com/PauloASilva/git-pushed.git git-pushed
$ cd git-pushed $ chmod a+x git-pushed
git-pushedto a system location (requires
$ sudo cp git-pushed /usr/local/bin