对于git来说,我是相当新的,并且除了解决一些简单的冲突之外,我们不得不处理更多的事情。我有一个项目和一个团队成员,我正在努力。当他正在处理一个较旧的副本时,我推了一堆我的更改(394344b)。当他推动他的改变时,他以某种方式覆盖了我所有的变化。看着git日志,看起来他打电话给git revert
,我猜他是如何放弃我的改变的。
所以基本上,现在我想将我的更改与他在git revert调用后所做的更改合并。这可能吗?
我用丢弃的代码创建了一个分支
git checkout 394344b -b a1
但每当我尝试合并两个分支时,它看起来与主分支看起来并不相同。我假设它是因为a1中的所有更改都比后者在主服务器中提交的更新。
编辑:这是日志
* 1230d87 2014-09-16 | white back ground fix (HEAD, origin/master, master) [Isaac Paulsen]
* 6a44fe3 2014-09-16 | various fixe [Isaac Paulsen]
* 60f12a8 2014-09-16 | Revert 4c74c8e..b85ae54 [Isaac Paulsen]
* b85ae54 2014-09-16 | Revert "Revert 394344b..0268ad9" [Isaac Paulsen]
* 394344b 2014-09-16 | Merge branch 'master' of https://github.com/crobertsbmw/HuntDay [Isaac Paulsen]
|\
| * 4c74c8e 2014-09-16 | Merge branch 'master' of github.com:crobertsbmw/HuntDay [croberts]
| |\
| * | e6dcb12 2014-09-16 | added permit application lookup (a1) [croberts]
* | | 3ed349c 2014-09-16 | Various changes [Isaac Paulsen]
| |/
|/|
* | d6a5a30 2014-09-16 | twitter icon added [Isaac Paulsen]
|/
* 1df231b 2014-09-16 | added search by code funcitonality [croberts]
* 57119d2 2014-09-16 | Fixed the emails [croberts]
* 209679f 2014-09-09 | updated app version [Isaac Paulsen]
* 74561e9 2014-09-04 | cordova.js added [Isaac Paulsen]
* e4ff4c8 2014-09-04 | Last commit. The plugins still aren't working. we need to figure that out [croberts]
* 3ebcf60 2014-09-04 | Added cordova.js and fixed some things [croberts]
* e5157b4 2014-09-04 | Changed the alerts to navigator.alert things [croberts]
* e5998e5 2014-09-04 | Commented out the magic decoder [croberts]
* 7d2bf8f 2014-09-04 | added cordova.js [Isaac Paulsen]
* e3fd1cf 2014-09-04 | Added gitignore [croberts]
* e4b9bc9 2014-09-03 | Create README.md [crobertsbmw]
* 8f6c0c8 2014-09-03 | Still trying to fix stuff [croberts]
* 5a215c1 2014-09-03 | Trying to get the repo set up [croberts]
* 282f07f 2014-09-03 | Fixing stuff [croberts]
* d9d85b6 2014-09-03 | First commit [croberts]
答案 0 :(得分:0)
有很多方法可以意外删除git中的更改 - “revert”不是其中之一。与开发人员聊聊他究竟认为自己在做什么。
假设您不想强制更新分支,您的正常恢复路径将是“恢复”恢复。
(注意,你没有提到你的分支名称,根据需要调整)
git checkout -b fix_reverts 1230d87
git revert 60f12a8
git revert b85ae54
然后在此基础上重新调整你的其他工作并继续照常进行。