Git I';我犯了个大错,我可以';我好像没法修好它。
我有3台机器: 笔记本电脑、台式机、服务器 我正在与两个分支合作:next和Regroups。重组是原始的,我希望它成为下一个新的 活动时间表:Git I';我犯了个大错,我可以';我好像没法修好它。,git,Git,我有3台机器: 笔记本电脑、台式机、服务器 我正在与两个分支合作:next和Regroups。重组是原始的,我希望它成为下一个新的 活动时间表: 1. I finish the last changes to regroup on Desktop and push them to Server 2. I pull from server to laptop 3. On, laptop I checkout next (next happens to be 2 commits ahead o
1. I finish the last changes to regroup on Desktop and push them to Server
2. I pull from server to laptop
3. On, laptop I checkout next (next happens to be 2 commits ahead of server/next)
// I want to take all the regroup changes and completly overwrite the next changes.
// I think this command will work (i'm not actually sure what it really did)
4. Laptop: git merge -s recursive -X theirs regroup
5. Laptop: git push
6. Oh no, I forgot to test before push. Quick test. Things break.
7. Laptop: git checkout regroup; git reset --hard HEAD. Test. Things still break.
// Ok, I'll just switch to my desktop whichi still works, and get that perfect branch back.
8. Desktop: Test, things still work. git checkout -b reset_final; git push origin reset_final
10. Laptop: git pull; git checkout reset_final. Test. Things still break!? Why!?
所以,现在,我的服务器和笔记本电脑似乎出了问题。我的桌面上仍然有我想要在RegroupandRegroupu_final下的分支,但我不知道如何在服务器上将其重置为该分支
我想做的是让我的桌面重新组合服务器的下一个。我想彻底摆脱我对服务器的愚蠢推送。我很困惑,我需要一些帮助
git merge -s recursive -X theirs regroup
当发生冲突时,这将选择“他们的”。但“我们的”非冲突性变更仍保留
git reset --hard HEAD
这将撤消工作目录中的任何更改。然而,由于合并已经提交,它可能不会撤消任何操作。您可以使用以下方法回滚上次提交:
git reset --hard HEAD^
最后一点,复制reset\u final
的方法不会复制未提交的更改。桌面上是否有未提交的更改?检查:
git status
没有未限制的更改。重置--hard HEAD^无效。似乎这些更改是在提交树的前一部分中进行的,下一部分在重新组合时重写了好的内容。