From: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Checkout file without changing index?
Date: Wed, 24 Apr 2019 20:15:37 +0200 [thread overview]
Message-ID: <CAA01CsrsSQ-_bhS_T5gxDqtPa0XKbHp1c7WCgdxLVvEA3fBSGA@mail.gmail.com> (raw)
In-Reply-To: <xmqq5zr31poo.fsf@gitster-ct.c.googlers.com>
On Wed, Apr 24, 2019 at 3:46 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Piotr Krukowiecki <piotr.krukowiecki@gmail.com> writes:
>
> > I was familiar with "git checkout revision -- file".
> >
> > But it updates both working tree and index. I had some changes in
> > index (staged) and "git checkout HEAD -- file" silently overwritten
> > it. Well, probably my mistake, it's documented.
>
> We'd invite you to live on the leading edge and try
>
> $ git restore --source=<revision> <pathspec>
>
> which by default checks things out only to the working tree, but not
> to the index (you say --staged if you want to restore to the index,
> and you say --worktree if you want to restore to the working tree,
> or you can say both, which would be the same as "git checkout").
Thanks, looks nice. git-checkout is a bit inconsistent at what it
does, and I understand the git-restore and git-switch are a better
replacement for it.
> I think the new command is now on the 'pu' branch, but in a few
> weeks hopefully it will appear on the 'next' branch.
Is it possible to get a Windows build?
--
Piotr Krukowiecki
next prev parent reply other threads:[~2019-04-24 18:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-24 13:37 Checkout file without changing index? Piotr Krukowiecki
2019-04-24 13:46 ` Junio C Hamano
2019-04-24 18:15 ` Piotr Krukowiecki [this message]
2019-04-24 20:16 ` Philip Oakley
2019-04-25 3:40 ` Sitaram Chamarty
2019-04-25 4:02 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAA01CsrsSQ-_bhS_T5gxDqtPa0XKbHp1c7WCgdxLVvEA3fBSGA@mail.gmail.com \
--to=piotr.krukowiecki@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).