Web lists-archives.com

Re: Feedback on git-restore




On Wed, May 15, 2019 at 12:59:17PM +0200, Ævar Arnfjörð Bjarmason wrote:
> One thing that would be really useful (and maybe it even exists, I just
> haven't seen it in the mails) is some abbreviated cheatsheet style doc
> of before/after in the UI. Similar to cheatsheets like e.g.:
> 
>     https://git.wiki.kernel.org/images-git/7/78/Git-svn-cheatsheet.pdf
>     http://unix4admins.blogspot.com/2013/03/unix-commands-comparison-sheet.html
> 
> As far as I can tell the best examples are your changes to
> s/checkout/[reset|switch]/ in various existing docs, that's great, but
> isn't so easy to understand at a glance.

OK the cheatsheet would be like this (I'm dropping "git" prefix to
keep it short)

checkout <branch>          -> switch <branch> (same "dwim" behavior)
checkout <revision>        -> switch --detach <revision>
checkout -b <branch> <rev> -> switch -c <branch> <rev>
checkout <path>            -> restore [--worktree] <path>
checkout <rev> -- <path>   -> restore --source=<rev> --worktree --staged <path>
reset <path>               -> restore --staged <path>
reset <rev> -- <path>      -> restore --source=<rev> --staged <path>
reset --hard               -> restore --source=HEAD --staged --worktree :/
(not available now)        -> restore --source=<rev> [--worktree] <path>

There are other behavior changes to improve things, e.g. --no-overlay
is the default in "git restore". But those can't be shown in a cheatsheet.
--
Duy