如何重置为特定的提交? [英] how to reset to a specific commit?

查看:80
本文介绍了如何重置为特定的提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行git log --oneline时,我有以下近期提交...我想重置为8ec2027,我尝试了一些没有工作的rebase命令..要做到这一点的确切命令是什么?

  2503013 code:cs release 1.2.3.47 
269ed14 code:修正了第二个客户端未关联的问题GO
dca02a3代码:不允许在WPS / EAPOL交换期间进行扫描。
b2fee57代码:MCC自适应调度器
6af29c4代码:无法连接多于10个STA
150aacd代码:修复5G频段的最大发射功率值和11小时的.ini支持。 b 8ec2027合并code:cs release 1.2.3.46
9015b60合并代码:对Prima的Quarky支持
......


解决方案

您想重置不会发生重置。重新激活是重放提交的行为。重置正在使当前提交另一个。



您需要先保存工作目录中可能存在的任何工作:

  git stash -u 

然后你将使你当前提交你想要的一个

  git reset --hard 8ec2027 



$ b

可选地,您可以在保存之前保存以下内容:

  git branch -b temp HEAD @ {1} 

请参阅reflog文档看看它是如何工作的。


I have the following recent commits when I do "git log --oneline"...I want to reset to "8ec2027",I tried some rebase commands that didnot work..what is the exact command to do this?

2503013 code: cs release 1.2.3.47
269ed14 code: Fixed below issues due to which 2nd client is not associating to GO
dca02a3 code: Donot allow the scan during WPS/EAPOL exchange.
b2fee57 code: MCC Adaptive Scheduler
6af29c4 code: Not able to connect more then 10 STA
150aacd code: Fix the Max Tx power value in 5G band and .ini support for 11h
8ec2027 Merge "code: cs release 1.2.3.46"
9015b60 Merge "code: Quarky Support on Prima"
......

解决方案

You want to reset not rebase. Rebasing is the act of replaying commits. Resetting is making the current commit some other one.

you will need to save any work that you may have in your work directory first:

 git stash -u

then you will make you current commit the one you want with

git reset --hard 8ec2027

Optionally, after you can save where you were before doing this with:

git branch -b temp HEAD@{1}

see reflog documentation to see how this works.

这篇关于如何重置为特定的提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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