git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to revert 'git reset' command

From
Junio C Hamano <gitster@pobox.com>
Date
May 1, 2010, 17:19 UTC
Message-ID
<7v63375ylt.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20100501064114.GA5643@screwed.box>
Peter Vereshagin <peter@vereshagin.org> writes:
Show 16 quoted lines
> 2010/04/30 22:48:38 -0700 paragkalra <paragkalra@gmail.com> => To git@vger.kernel.org :
> p> I have just started learning - Git. Today while exploring Git, I executed
> p> following:
> p> 
> p> git reset
> p> 
> p> Now 'git status' is showing some files under - 'Unstaged changes after
> p> reset:'
> p> 
> p> How can I revert back the effect of - 'git reset'
> p> 
> You may want to try to make a new commit:
>
> git commit -a
>
> Another way is to rerpair your Git history from your remote repository, if one exists

If "git reset" was run without any other options nor arguments (which paragkalra seems to have done), there is no damage in the git history that needs to be repaired. "git reset" by default only resets the index to match the commit that is checked out. All that is lost is "git add" done since that commit.

Previous: Peter Vereshagin
Message 3 of 3 in “How to revert 'git reset' command”
  1. paragkalraMay 1, 2010
  2. Peter VereshaginMay 1, 2010
  3. Junio C HamanoMay 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.