git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Reverting to old commit
@ 2008-05-27 17:50 Marcus
  2008-05-27 18:09 ` Jakub Narebski
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Marcus @ 2008-05-27 17:50 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reverting to old commit
  2008-05-27 17:50 Reverting to old commit Marcus
@ 2008-05-27 18:09 ` Jakub Narebski
  2008-05-27 20:43   ` Brandon Casey
  2008-05-27 19:32 ` Sverre Rabbelier
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Jakub Narebski @ 2008-05-27 18:09 UTC (permalink / raw)
  To: Marcus; +Cc: git

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reverting to old commit
  2008-05-27 17:50 Reverting to old commit Marcus
  2008-05-27 18:09 ` Jakub Narebski
@ 2008-05-27 19:32 ` Sverre Rabbelier
  2008-05-27 20:02 ` Dirk Süsserott
  2008-05-27 20:41 ` Robin Rosenberg
  3 siblings, 0 replies; 8+ messages in thread
From: Sverre Rabbelier @ 2008-05-27 19:32 UTC (permalink / raw)
  To: Marcus; +Cc: git

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reverting to old commit
  2008-05-27 17:50 Reverting to old commit Marcus
  2008-05-27 18:09 ` Jakub Narebski
  2008-05-27 19:32 ` Sverre Rabbelier
@ 2008-05-27 20:02 ` Dirk Süsserott
  2008-05-27 20:17   ` Paolo Bonzini
  2008-05-27 20:41 ` Robin Rosenberg
  3 siblings, 1 reply; 8+ messages in thread
From: Dirk Süsserott @ 2008-05-27 20:02 UTC (permalink / raw)
  To: Marcus; +Cc: git

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reverting to old commit
  2008-05-27 20:02 ` Dirk Süsserott
@ 2008-05-27 20:17   ` Paolo Bonzini
  0 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2008-05-27 20:17 UTC (permalink / raw)
  To: Dirk Süsserott; +Cc: Marcus, git


> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reverting to old commit
  2008-05-27 17:50 Reverting to old commit Marcus
                   ` (2 preceding siblings ...)
  2008-05-27 20:02 ` Dirk Süsserott
@ 2008-05-27 20:41 ` Robin Rosenberg
  3 siblings, 0 replies; 8+ messages in thread
From: Robin Rosenberg @ 2008-05-27 20:41 UTC (permalink / raw)
  To: Marcus; +Cc: git

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reverting to old commit
  2008-05-27 18:09 ` Jakub Narebski
@ 2008-05-27 20:43   ` Brandon Casey
  2008-05-27 23:00     ` Sverre Rabbelier
  0 siblings, 1 reply; 8+ messages in thread
From: Brandon Casey @ 2008-05-27 20:43 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Marcus, git

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Reverting to old commit
  2008-05-27 20:43   ` Brandon Casey
@ 2008-05-27 23:00     ` Sverre Rabbelier
  0 siblings, 0 replies; 8+ messages in thread
From: Sverre Rabbelier @ 2008-05-27 23:00 UTC (permalink / raw)
  To: Brandon Casey; +Cc: Jakub Narebski, Marcus, git

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-05-27 23:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-27 17:50 Reverting to old commit Marcus
2008-05-27 18:09 ` Jakub Narebski
2008-05-27 20:43   ` Brandon Casey
2008-05-27 23:00     ` Sverre Rabbelier
2008-05-27 19:32 ` Sverre Rabbelier
2008-05-27 20:02 ` Dirk Süsserott
2008-05-27 20:17   ` Paolo Bonzini
2008-05-27 20:41 ` Robin Rosenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).