Git Problems

The purpose of this document is to show how to solve the git problems.

Commit rejected because you are behind

# git push upstream warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) To git@github.com:reellio/puppet.git ! [rejected] sprint-work -> sprint-work (non-fast-forward) error: failed to push some refs to 'git@github.com:reellio/puppet.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') hint: before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Solve with merge

# git merge upstream/sprint-work Merge made by the 'recursive' strategy. manifests/site.pp | 4 ++++ 1 file changed, 4 insertions(+)

Commit rejected because you diverged due to rebasing from another repo

Solve via the following:

# First, reset to origin # Then merge instead of rebasing git merge inbound/alpha --no-ff --option-strategy theirs

[Edit]