git - Make branch point to the tip of the branch that originated it
问题描述
I performed QA of a feature in the system doing the following:
- Created a
staging
branch frommaster
. - Merged the feature branch
task-123
intostaging
. - Deployed
staging
to the test server. - QA'd the functionality.
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)?
解决方案
我认为这就是你想要的,但这是如此基本的“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
推荐阅读
- java - 如何使用 javafx 在条件下显示或隐藏图像
- mysql - MySQL 5.1.73 更改 general_log 文件的时间戳格式
- azure - 如何阻止 appSetting.config 中的反斜杠加倍
- python - 使用 crontab 安排 Python 脚本不起作用
- postgresql - AND 的参数必须是布尔类型,而不是 postgresql 中的整数类型
- javascript - 如果我选择了第一个下拉菜单,下拉值会发生变化
- python - 将活性探针添加到 Rest API
- r - 如何返回在短信中使用禁止词的学生的 ID(更新)
- magento2 - 保存产品后丰富的片段是可以的,但几分钟后失败,M2.3.4
- c# - C# 将 COM 引用添加到类库