# Reverting to old commit

8 messages from 2008-05-27 to 2008-05-27. Participants: Marcus, Jakub Narebski, Sverre Rabbelier, Dirk Süsserott, Paolo Bonzini, Brandon Casey, Robin Rosenberg.
Thread: https://gitlist.dev/t/13693

## Marcus, 2008-05-27 17:50

Subject: Reverting to old commit
Message-ID: <8345bd80805271050q7412917bt292a276fbbe6aed3@mail.gmail.com>
URL: https://gitlist.dev/e/8345bd80805271050q7412917bt292a276fbbe6aed3%40mail.gmail.com

```
Newbie question: What's the simplest way to find an old commit and revert?

Say you have a version from yesterday which worked and today's
experiments failed, so you want to go back to that working version.
Unfortunately, it's not tagged. Instead you need to actually view the
code to identify the version you want. I thought maybe gitk might
help, but I can't find my way with gitk. I hoped you could browse
revisions easier in a GUI and tell gitk or git-gui to revert?

Thanks,

Marcus

```

## Jakub Narebski, 2008-05-27 18:09

Subject: Re: Reverting to old commit
Message-ID: <m3bq2r39gh.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3bq2r39gh.fsf%40localhost.localdomain
In-Reply-To: <8345bd80805271050q7412917bt292a276fbbe6aed3@mail.gmail.com>

```
Marcus <prima@wordit.com> writes:

> Newbie question: What's the simplest way to find an old commit and revert?
> 
> Say you have a version from yesterday which worked and today's
> experiments failed, so you want to go back to that working version.
> Unfortunately, it's not tagged. Instead you need to actually view the
> code to identify the version you want. I thought maybe gitk might
> help, but I can't find my way with gitk. I hoped you could browse
> revisions easier in a GUI and tell gitk or git-gui to revert?

Errr... isn't it what git-bisect is for?

If it is not, viewing git-log, or git-reflog output should help...
-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Sverre Rabbelier, 2008-05-27 19:32

Subject: Re: Reverting to old commit
Message-ID: <bd6139dc0805271232x53e91c0fx699c1ea0769e50ec@mail.gmail.com>
URL: https://gitlist.dev/e/bd6139dc0805271232x53e91c0fx699c1ea0769e50ec%40mail.gmail.com
In-Reply-To: <8345bd80805271050q7412917bt292a276fbbe6aed3@mail.gmail.com>

```
On Tue, May 27, 2008 at 7:50 PM, Marcus <prima@wordit.com> wrote:
> Newbie question: What's the simplest way to find an old commit and revert?
>
> Say you have a version from yesterday which worked and today's
> experiments failed, so you want to go back to that working version.
> Unfortunately, it's not tagged. Instead you need to actually view the
> code to identify the version you want. I thought maybe gitk might
> help, but I can't find my way with gitk. I hoped you could browse
> revisions easier in a GUI and tell gitk or git-gui to revert?

Have a look at the reflog (git reflog) perhaps combined with "git log
-p" which will show the changes each commit introduced as well.

-- 
Cheers,

Sverre Rabbelier

```

## Dirk Süsserott, 2008-05-27 20:02

Subject: Re: Reverting to old commit
Message-ID: <483C68E5.1040408@dirk.my1.cc>
URL: https://gitlist.dev/e/483C68E5.1040408%40dirk.my1.cc
In-Reply-To: <8345bd80805271050q7412917bt292a276fbbe6aed3@mail.gmail.com>

```
Marcus schrieb:
> Newbie question: What's the simplest way to find an old commit and revert?
>
> Say you have a version from yesterday which worked and today's
> experiments failed, so you want to go back to that working version.
> Unfortunately, it's not tagged. Instead you need to actually view the
> code to identify the version you want. I thought maybe gitk might
> help, but I can't find my way with gitk. I hoped you could browse
> revisions easier in a GUI and tell gitk or git-gui to revert?
>
> Thanks,
>
> Marcus
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>   
Probably I misunderstood, but: do you *know* which version worked
well? I.e. when you start gitk, can you point to the working
commit and are just wondering how to revert to that one?

Then gitk's "reset ... branch to here" could help you. Right-click
the desired commit and reset the branch.

There's no need to have a tag for this. You can even create a
tag afterwards for any commit you like. It's just an alias for
the commit id (sha1).

If you cannot identify the working commit, then please forget
my answer and follow the "git bisect" proposals.

```

## Paolo Bonzini, 2008-05-27 20:17

Subject: Re: Reverting to old commit
Message-ID: <483C6C44.1010304@gnu.org>
URL: https://gitlist.dev/e/483C6C44.1010304%40gnu.org
In-Reply-To: <483C68E5.1040408@dirk.my1.cc>

```

> Then gitk's "reset ... branch to here" could help you. Right-click
> the desired commit and reset the branch.

DON'T do this though if you have published the branch somewhere.

Do "git-revert -n" on all the commits after the buggy one in that case, 
starting from the last, then "git commit".

Paolo

```

## Robin Rosenberg, 2008-05-27 20:41

Subject: Re: Reverting to old commit
Message-ID: <200805272241.04884.robin.rosenberg.lists@dewire.com>
URL: https://gitlist.dev/e/200805272241.04884.robin.rosenberg.lists%40dewire.com
In-Reply-To: <8345bd80805271050q7412917bt292a276fbbe6aed3@mail.gmail.com>

```
tisdagen den 27 maj 2008 19.50.31 skrev Marcus:
> Newbie question: What's the simplest way to find an old commit and revert?
> 
> Say you have a version from yesterday which worked and today's
> experiments failed, so you want to go back to that working version.
> Unfortunately, it's not tagged. Instead you need to actually view the
> code to identify the version you want. I thought maybe gitk might
> help, but I can't find my way with gitk. I hoped you could browse
> revisions easier in a GUI and tell gitk or git-gui to revert?

If you know a line of code that you know or suspect is wrong, you
can find the commit that introduced the version using git blame. 

-- robin

```

## Brandon Casey, 2008-05-27 20:43

Subject: Re: Reverting to old commit
Message-ID: <6IRlPIxadiyIIPsto-MFx6wInl0VvCRxVSaI3-OglmCjLt5obfbiww@cipher.nrlssc.navy.mil>
URL: https://gitlist.dev/e/6IRlPIxadiyIIPsto-MFx6wInl0VvCRxVSaI3-OglmCjLt5obfbiww%40cipher.nrlssc.navy.mil
In-Reply-To: <m3bq2r39gh.fsf@localhost.localdomain>

```
Jakub Narebski wrote:
> Marcus <prima@wordit.com> writes:
> 
>> Newbie question: What's the simplest way to find an old commit and revert?
>>
>> Say you have a version from yesterday which worked and today's
>> experiments failed, so you want to go back to that working version.
>> Unfortunately, it's not tagged. Instead you need to actually view the
>> code to identify the version you want. I thought maybe gitk might
>> help, but I can't find my way with gitk. I hoped you could browse
>> revisions easier in a GUI and tell gitk or git-gui to revert?
> 
> Errr... isn't it what git-bisect is for?
> 
> If it is not, viewing git-log, or git-reflog output should help...

Shouldn't we be encouraging the use of 'git log -g' rather than 'git reflog'?
git-reflog seems more like plumbing than porcelain to me.

-brandon

```

## Sverre Rabbelier, 2008-05-27 23:00

Subject: Re: Reverting to old commit
Message-ID: <bd6139dc0805271600k6968b6c7j9075bb8aeffe9863@mail.gmail.com>
URL: https://gitlist.dev/e/bd6139dc0805271600k6968b6c7j9075bb8aeffe9863%40mail.gmail.com
In-Reply-To: <6IRlPIxadiyIIPsto-MFx6wInl0VvCRxVSaI3-OglmCjLt5obfbiww@cipher.nrlssc.navy.mil>

```
On Tue, May 27, 2008 at 10:43 PM, Brandon Casey <casey@nrlssc.navy.mil> wrote:

> Shouldn't we be encouraging the use of 'git log -g' rather than 'git reflog'?
> git-reflog seems more like plumbing than porcelain to me.

I had no idea, but then again, the man pages don't mention whether
something is plumbing or porcelain anywhere... But I guess 'git log
-g' is easier to use (since it supplies the user with most of git
log's features) than git reflog. I was introduced to reflog by someone
advising me to use it, so I was merely "passing on" that advice,
unknowing of 'git log -g' :).

-- 
Cheers,

Sverre Rabbelier

```
