从您的问题中不太清楚,但我猜您正在寻求一种方法来重写分支的历史记录developer
,忘记分支中的所有先前更改,并使developer
分支与当前的master
.
如果是这种情况,您只需将分支指针移动developer
到master
:
# Checkout any other branch than developer, using master as an example
# Any other branch should also work
git checkout master
# Move the branch pointer of developer to the current master
git branch -f developer master
# Push the commits for developer
# **WARNING:** This is going to rewrite history
# Also all commits under the old developer branch will become dangling
git push -f origin developer