恢复到较早的提交并与 Git 中最新的提交合并
例如,我有这样的历史:
commit 1a7cab6c279f5528871cd0ab8dae55319ff81fc0
Author: unknown <poru@.(none)>
Date: Thu Mar 10 20:11:39 2011 +0800
Changes to login style, will based the admin on this. version-1
commit 22d308ba085a5d04eadf54fd06f3534e876386de
Author: David Ang <[email protected]>
Date: Tue Mar 8 23:40:59 2011 +0800
fixed config settings to run in production mode and removed special
characters thats disrupting heroku
commit 410b383e105fac39bd70095b186367fa943b1ad8
Author: David Ang <[email protected]>
Date: Fri Mar 4 01:29:45 2011 +0800
show pretty time ago
provide icons
hide mass delete
removed special character
commit 789922463ad946c945893c9a8787e589f780fda1
Author: unknown <poru@.(none)>
Date: Thu Mar 3 18:34:09 2011 +0800
Tempory style for Login. Will replace this once done with the admin
styles.
我们有一个新的设计正在进行最近的提交 - 但我现在想切换回我们原来的设计,即提交 78992246。
我之前喜欢做这样的事情:
git checkout 78992246
然后我希望只需将它们合并回 master 的头部即可。
不幸的是我没有到达任何地方
So for example i have this history:
commit 1a7cab6c279f5528871cd0ab8dae55319ff81fc0
Author: unknown <poru@.(none)>
Date: Thu Mar 10 20:11:39 2011 +0800
Changes to login style, will based the admin on this. version-1
commit 22d308ba085a5d04eadf54fd06f3534e876386de
Author: David Ang <[email protected]>
Date: Tue Mar 8 23:40:59 2011 +0800
fixed config settings to run in production mode and removed special
characters thats disrupting heroku
commit 410b383e105fac39bd70095b186367fa943b1ad8
Author: David Ang <[email protected]>
Date: Fri Mar 4 01:29:45 2011 +0800
show pretty time ago
provide icons
hide mass delete
removed special character
commit 789922463ad946c945893c9a8787e589f780fda1
Author: unknown <poru@.(none)>
Date: Thu Mar 3 18:34:09 2011 +0800
Tempory style for Login. Will replace this once done with the admin
styles.
We have a new design going on the most recent commit - but i wanted now to switch back to our original design which is commit 78992246.
I was like doing something like this earlier:
git checkout 78992246
Then I was hoping to just merge these back to the head of master.
Unfortunately im not getting anywhere
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是执行此操作的一些步骤。
Here are some steps to do it.
一旦切换到正确的提交,您应该在尝试任何合并之前创建一个分支。
或一步
否则,您将处于分离头模式。
Once you have switched to the right commit, you should create a branch before attempting any merge.
or in one step
Other wise you would be in a detached head mode.