20

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"
......
Antony Hatchkins
  • 31,947
  • 10
  • 111
  • 111
user1934146
  • 2,905
  • 10
  • 25
  • 25

2 Answers2

33

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.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
  • if i want to reset to a specific commit..what will stash -u save?am trying to understand how git stash -u is useful before reset? – user1934146 Jan 14 '13 at 07:54
  • It will save uncommitted changes, that is modifications to files in the working dir introduced after your last `git commit` command. – Antony Hatchkins Jan 14 '13 at 08:01
3

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

Evgeny
  • 361
  • 2
  • 5