這是我平時做我的工作:的Git分支衍合
git checkout -b my_branch
git commit -m 'fixed something #8852'
git rebase -i master
git push origin my_branch
然後一段時間後,我需要在同一分支上工作了。從那時起,新的提交出現在主分支上。我檢查了我的分支,進行了更改,提交併做了'git rebase -i master'。但是,當我試圖做「混帳推起源my_branch」它給了我一個錯誤:
! [rejected] my_branch -> my_branch (non-fast-forward)
error: failed to push some refs to 'https://github.com/XXX.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我的主人是最新的。所以從my_branch我做了
git pull --rebase origin my_branch
git push origin my_branch
我認爲它重新設置了所有新的提交到我的分支。現在在my_branch上我有不屬於它的提交。注意:我的團隊領導要求我總是進行rebase來避免合併。我應該如何解決這個錯誤,以便my_branch只包含我的提交?