how to reset to a specific commit?

若如初见. 提交于 2020-01-04 03:55:09

问题


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"
......

回答1:


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.




回答2:


Probably this could also work out for you

  1. Create a new branch at 2503013 (this saves the changes after 8ec202)

  2. git reset --hard 8ec2027



来源:https://stackoverflow.com/questions/14314596/how-to-reset-to-a-specific-commit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!