简体   繁体   English

修复git分支问题

[英]Fix git branching issue

I am uncertain how to fix this one and feel like I may have painted myself into a corner. 我不确定如何解决这个问题,并觉得自己可能陷入困境。

git日志绘制

Above is my git tree graphed and all the relevant branches. 上面是我的git树和所有相关分支的图形。 As you can see, I've somehow left master behind. 如您所见,我不知何故将主人抛在了身后。 The reason for this is that master contains some broken code somewhere in those 4 commits. 这是因为master在这4次提交中的某处包含一些损坏的代码。

I would like to abandon that entire branch and stick master on the same level at T156 and if possible maybe merge one commit from the T145-Fix-app-php branch into the now T156 branch. 我想在T156放弃整个分支并将主控制器保持在同一级别,如果可能的话,可以将T145-Fix-app-php分支中的一项提交合并到现在的T156分支中。

BTW I do most of my commits using standard git commands at the CLI and the screen shot was taken from the latest version of gitlabs. 顺便说一句,我在命令行界面上使用标准git命令来完成大多数提交工作,并且屏幕截图取自最新版本的gitlabs。 So either tool is available for me to fix this SNAFU. 因此,我可以使用任一工具来修复此SNAFU。

If you are okay with discarding your existing master branch, then maybe: 如果您可以丢弃现有的master分支,则可以:

git checkout master
git reset --hard T156

If you want to preserve the old master branch, then maybe: 如果要保留旧的master分支,则可能:

git checkout master
git branch old-master
git reset --hard T156

This preserve your old master branch as old-master . 这会将您的旧master分支保留为old-master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM