## 02 push rejected non-fast-forward $ git push origin feature/my_feature_branch To /tmp/tfs/r2.git ! [rejected] feature/my_feature_branch -> feature/my_feature_branch (fetch first) error: failed to push some refs to '/tmp/tfs/r2.git' hint: Updates were rejected because the remote contains work that you do not hint: have locally. This is usually caused by another repository pushing to hint: the same ref. If you want to integrate the remote changes, use hint: 'git pull' before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. [exit 1] # answer: git fetch; git rebase feature/my_feature_branch; git push $ git fetch From /tmp/tfs/r2 6e4229b..471688d feature/my_feature_branch -> origin/feature/my_feature_branch [exit 0] $ git rebase feature/my_feature_branch Current branch feature/my_feature_branch is up to date. [exit 0] $ git push origin feature/my_feature_branch To /tmp/tfs/r2.git ! [rejected] feature/my_feature_branch -> feature/my_feature_branch (non-fast-forward) error: failed to push some refs to '/tmp/tfs/r2.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. If you want to integrate the remote changes, hint: use 'git pull' before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. [exit 1] # with origin/ added to the rebase target $ git rebase origin/feature/my_feature_branch Rebasing (1/1) Successfully rebased and updated refs/heads/feature/my_feature_branch. [exit 0] $ git push origin feature/my_feature_branch To /tmp/tfs/r2.git 471688d..6815fed feature/my_feature_branch -> feature/my_feature_branch [exit 0]