Git-还原还原,冲突 [英] Git - reverting a revert, conflicts

查看:369
本文介绍了Git-还原还原,冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我进行了一些提交,然后将其还原.如何还原还原? (还原后,分支上还有其他提交).如果我将分支重新合并到master中,则会得到already updated,因为它已经包含了所有我想的提交.

I've made some commits and then reverted them. How do I revert the revert? (After my revert there are other commits on the branch). If I remerge my branch into master I get already updated because it already includes all of those commits I suppose.

* b1e0603 - other commit 
* f835cec - Revert "" 
* 68ffc84 - Revert ""
* da5795b - Revert ""
* 75ae2a0 - Revert ""
*   4e51f8f - Merge branch 'master'
|\  
| * 58a6fe8 - commit
* |   205f2a2 - Merge branch 'on this branch are my commits that weere reverted'
|\ \  
| |/  
|/|   
| * 425d6f3 - commit
* |   0efc0e9 - Merge branch 'on this branch are my commits that weere reverted'

执行git revert 75ae2a0输出冲突.我必须执行10次还原操作.我是否应该还原合并(205f2a2)?

Doing git revert 75ae2a0 ouputs conflicts. And there are like 10 reverts that I have to run. Should I just revert the merge (205f2a2)?

谢谢!

推荐答案

总结上面的讨论,由于您没有推送更改,因此可以使用git reset/revert重写更改(取决于您的具体情况).

Summarizing the discussion above, as you did not push your changes you can re-write you changes with git reset/revert (depends on your specific case).

您可以在 Atlassian Git教程(尤其是在撤消更改,其中讨论了有关git checkout,重置和还原命令以及重置,签出和还原,在提交级别和文件级别.

You can find some great tutorials about your options here in Atlassian Git Tutorials, and specifically in chapters Undoing Changes that discuss your options with git checkout, reset and revert commands, and Reset, Checkout, and Revert that discusses these command both in commit level and file level.

但是,有一项建议-由于其中一些命令是不可逆的,因此我建议您对存储库和当前提交进行备份,以防万一出现问题,您将对所做的更改进行备份.

One recommendation, though - as some of these commands are irreversible I'd recommend you to make a backup of your repo and current commits so in case something will get wrong you will have a backup of your changes.

这篇关于Git-还原还原,冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆