首页 > 解决方案 > Make branch point to the tip of the branch that originated it

问题描述

I performed QA of a feature in the system doing the following:

The QA failed, and now I want to make staging point back to the latest commit of master, so it will be ready for QA of other feature branches.

How can I do it using relative branching reference (no hashes)?

标签: gitbranchbranching-and-merging

解决方案


我认为这就是你想要的,但这是如此基本的“git 101”,我不禁觉得我错过了一些东西,而你想要更复杂的东西。

如果你想重置staging回你开始的地方

<in the staging branch>
git reset --hard $(git merge-base HEAD origin/master) 
git push --force

如果你想重置staging到master的当前状态

<in the staging branch>
git fetch
git reset --hard origin/master
git push --force

推荐阅读