This is way:
When doing git fetch it just fetch current branch, let's say prod branch, see code, and when does git push tries to push both branches: master and prod, code here but master branch is not updated and fails.
Error log:
PHP User Error: Failed merge & push: s:581:"error: failed to push some refs to 'git@github.com:x/xx.git' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. Check out this branch and integrate the remote changes hint: (e.g. 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. To git@github.com:x/xx.git = refs/heads/prod:refs/heads/prod [up to date] ! refs/heads/master:refs/heads/master [rejected] (non-fast-forward) Branch prod set up to track remote branch prod from origin. Done"; in /www/x/git-webhook.php on line 37 when calling trigger_error(), request: GET /git-webhook.php
This is way: When doing
git fetch
it just fetch current branch, let's sayprod
branch, see code, and when doesgit push
tries to push both branches:master
andprod
, code here butmaster
branch is not updated and fails.Error log: