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

Re: [PATCH] git-checkout.txt: Document "git checkout <pathspec>" better

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 10, 2015, 16:38 UTC
Message-ID
<xmqq7frbmsce.fsf@gitster.dls.corp.google.com>
In-Reply-To
<loom.20150610T170737-586@post.gmane.org>
Ed Avis <eda@waniasset.com> writes:
> 'restore' may be more consistent with git's internal terminology.
> But from an outsider's perspective, 'revert' rather than 'restore' is in my
> view much clearer and more consistent with other version control systems:
> for example 'svn revert' is what you use to revert files in the working copy.

The reason why I said "restore" is because it does *not* have any "internal terminology" connotation.

On the other hand, "revert" that means "create a counter-effect commit" is not "internal". "git revert" is a part of end-user facing command.

The only people that will be helped by using "revert" there will be the ones who haven't learned "git revert". And it will make it harder for them to learn "git revert". It is unfortunate that other systems use the word "revert" in a different way, and that is why we should avoid using that word when describing "checkout".

Show 6 quoted lines
> The original issue was that I naively expected that 'git checkout PATH' would
> indeed just 'restore' some files, that is, create them when they are missing.
> ...
> If 'revert' is not a suitable verb because of the existing git-revert, then
> I suggest that 'overwrite' or 'replace' might better convey the idea of what
> the command does.

Git is about "contents", not "files". You modify a file, and restore its contents to its pristine state. It is not "restore the file", as Git is not about "files".

I think "overwrite is better" is primarily coming from not thinking in terms of "Git tracks contents, not files".

Previous: Ed AvisNext: Ed Avis
Message 4 of 12 in “git-checkout.txt: Document "git checkout <pathspec>" better”
  1. git-checkout.txt: Document "git checkout <pathspec>" betterTorsten Bögershausen, Jun 8, 2015
  2. Junio C HamanoJun 10, 2015
  3. Ed AvisJun 10, 2015
  4. Junio C HamanoJun 10, 2015
  5. Ed AvisJun 11, 2015
  6. Torsten BögershausenJun 10, 2015
  7. Junio C HamanoJun 11, 2015
  8. Ed AvisJun 11, 2015
  9. Junio C HamanoJun 11, 2015
  10. Scott SchmitJun 12, 2015
  11. Junio C HamanoJun 12, 2015
  12. Torsten BögershausenJun 12, 2015

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.