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

Re: Git reset --hard with staged changes

From
Christian Couder <christian.couder@gmail.com>
Date
May 31, 2016, 06:41 UTC
Message-ID
<CAP8UFD18mbT12+9P0vqNWAnNirCD0oRz1O-ajFmm5y1BNTdVFA@mail.gmail.com>
In-Reply-To
<xmqqvb1u7okk.fsf@gitster.mtv.corp.google.com>
On Tue, May 31, 2016 at 8:02 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
>
> diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
> index 25432d9..c4cc035 100644
> --- a/Documentation/git-reset.txt
> +++ b/Documentation/git-reset.txt
> @@ -65,8 +65,14 @@ If `-N` is specified, removed paths are marked as intent-to-add (see
>  linkgit:git-add[1]).
>
>  --hard::
> -       Resets the index and working tree. Any changes to tracked files in the
> -       working tree since <commit> are discarded.
> +       Reset the index and the working tree to be identical to the
> +       tree of the given <commit> (defaults to HEAD) by discarding
> +       the changes made to them relative to <commit>.  Paths
> +       modified in the index and in the working tree are reset to
> +       what is recorded in <commit>.  Paths removed in the working
> +       tree and in the index are resurrected from <commit>.  Paths
> +       added to the index and the working tree since <commit> are
> +       removed.
This is a great improvement.

I am not sure that it will be enough to make people use `git stash` and `git reset --keep` more though. But maybe that can wait until the next time someone complain.

Thanks, Christian.

Previous: Junio C Hamano
Message 8 of 8 in “Re: Git reset --hard with staged changes”
  1. Yotam GingoldMay 23, 2016
  2. Junio C HamanoMay 23, 2016
  3. Christian CouderMay 23, 2016
  4. Junio C HamanoMay 23, 2016
  5. Christian CouderMay 24, 2016
  6. Yotam GingoldMay 30, 2016
  7. Junio C HamanoMay 31, 2016
  8. Christian CouderMay 31, 2016

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.