Re: [PATCH v2 7/7] Suggest other commands instead of "git checkout"

2018-11-28 Thread Junio C Hamano
Duy Nguyen  writes:

> I see my deliberate attempt to provoke has failed :D Giving your view
> of the new commands as "training wheels", I take it we still should
> make them visible as much as possible, but we just not try to hide
> "git checkout" as much (e.g. we mention both new and old commands,
> instead of just mentioning the new one, when suggesting something)?

Yes, I do support the overall idea of learning two (or possibly
three) separate commands would help new users to form the right
mental model much sooner than learning one that can be used in
multiple ways.  Another possible approach could be to split the use
of "reset" that does not move "HEAD" into the same half of
"checkout" that does not move "HEAD", i.e. checkout-files.


Re: [PATCH v2 7/7] Suggest other commands instead of "git checkout"

2018-11-28 Thread Duy Nguyen
On Wed, Nov 28, 2018 at 7:04 AM Junio C Hamano  wrote:
>
> Nguyễn Thái Ngọc Duy   writes:
>
> > The assumption made is here
> >
> > - "git checkout" is a horrible monster that should only be touched
> >   with a two-meter pole
> >
> > - there are other commands that can achieve the same thing
>
> Thanks for clearly spelling out the assumptions.  It is good that
> this step cames at the end, as the earlier 6 steps looked reasonable
> to me.

I see my deliberate attempt to provoke has failed :D Giving your view
of the new commands as "training wheels", I take it we still should
make them visible as much as possible, but we just not try to hide
"git checkout" as much (e.g. we mention both new and old commands,
instead of just mentioning the new one, when suggesting something)?
-- 
Duy


Re: [PATCH v2 7/7] Suggest other commands instead of "git checkout"

2018-11-27 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy   writes:

> The assumption made is here
>
> - "git checkout" is a horrible monster that should only be touched
>   with a two-meter pole
>
> - there are other commands that can achieve the same thing

Thanks for clearly spelling out the assumptions.  It is good that
this step cames at the end, as the earlier 6 steps looked reasonable
to me.

Thanks.


>
> Signed-off-by: Nguyễn Thái Ngọc Duy 
> ---
>  Documentation/git-branch.txt   |  8 ++--
>  Documentation/git-check-ref-format.txt |  2 +-
>  Documentation/git-format-patch.txt |  2 +-
>  Documentation/git-merge-base.txt   |  2 +-
>  Documentation/git-rebase.txt   |  2 +-
>  Documentation/git-remote.txt   |  2 +-
>  Documentation/git-rerere.txt   | 10 ++---
>  Documentation/git-reset.txt| 18 -
>  Documentation/git-revert.txt   |  2 +-
>  Documentation/git-stash.txt|  6 +--
>  Documentation/gitattributes.txt|  2 +-
>  Documentation/gitcli.txt   |  4 +-
>  Documentation/gitcore-tutorial.txt | 18 -
>  Documentation/giteveryday.txt  | 24 ++--
>  Documentation/githooks.txt |  5 ++-
>  Documentation/gittutorial-2.txt|  2 +-
>  Documentation/gittutorial.txt  |  4 +-
>  Documentation/revisions.txt|  2 +-
>  Documentation/user-manual.txt  | 54 +-
>  advice.c   |  2 +-
>  sha1-name.c|  2 +-
>  wt-status.c|  2 +-
>  22 files changed, 88 insertions(+), 87 deletions(-)
>
> diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
> index bf5316ffa9..1564df47d2 100644
> --- a/Documentation/git-branch.txt
> +++ b/Documentation/git-branch.txt
> @@ -48,7 +48,7 @@ The command's second form creates a new branch head named 
> 
>  which points to the current `HEAD`, or  if given.
>  
>  Note that this will create the new branch, but it will not switch the
> -working tree to it; use "git checkout " to switch to the
> +working tree to it; use "git switch-branch " to switch to the
>  new branch.
>  
>  When a local branch is started off a remote-tracking branch, Git sets up the
> @@ -194,7 +194,7 @@ This option is only applicable in non-verbose mode.
>  +
>  This behavior is the default when the start point is a remote-tracking 
> branch.
>  Set the branch.autoSetupMerge configuration variable to `false` if you
> -want `git checkout` and `git branch` to always behave as if `--no-track`
> +want `git switch-branch` and `git branch` to always behave as if `--no-track`
>  were given. Set it to `always` if you want this behavior when the
>  start-point is either a local or remote-tracking branch.
>  
> @@ -293,7 +293,7 @@ Start development from a known tag::
>  $ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
>  $ cd my2.6
>  $ git branch my2.6.14 v2.6.14   <1>
> -$ git checkout my2.6.14
> +$ git switch-branch my2.6.14
>  
>  +
>  <1> This step and the next one could be combined into a single step with
> @@ -319,7 +319,7 @@ NOTES
>  -
>  
>  If you are creating a branch that you want to checkout immediately, it is
> -easier to use the git checkout command with its `-b` option to create
> +easier to use the "git switch-branch" command with its `-b` option to create
>  a branch and check it out with a single command.
>  
>  The options `--contains`, `--no-contains`, `--merged` and `--no-merged`
> diff --git a/Documentation/git-check-ref-format.txt 
> b/Documentation/git-check-ref-format.txt
> index d9de992585..38c2169d7a 100644
> --- a/Documentation/git-check-ref-format.txt
> +++ b/Documentation/git-check-ref-format.txt
> @@ -88,7 +88,7 @@ but it is explicitly forbidden at the beginning of a branch 
> name).
>  When run with `--branch` option in a repository, the input is first
>  expanded for the ``previous checkout syntax''
>  `@{-n}`.  For example, `@{-1}` is a way to refer the last thing that
> -was checked out using "git checkout" operation. This option should be
> +was checked out using "git switch-branch" operation. This option should be
>  used by porcelains to accept this syntax anywhere a branch name is
>  expected, so they can act as if you typed the branch name. As an
>  exception note that, the ``previous checkout operation'' might result
> diff --git a/Documentation/git-format-patch.txt 
> b/Documentation/git-format-patch.txt
> index aba4c5febe..0ceaa1173c 100644
> --- a/Documentation/git-format-patch.txt
> +++ b/Documentation/git-format-patch.txt
> @@ -416,7 +416,7 @@ One way to test if your MUA is set up correctly is:
>  * Apply it:
>  
>  $ git fetch  master:test-apply
> -$ git checkout test-apply
> +$ git switch-branch test-apply
>  $ git reset --hard
>  $ git am a.patch
>  
> diff --git a/Documentation/git-merge-base.txt 
> b/Documentation/git-merge-base.txt
> index 9f07f4f6ed..1b25e5d530 100644
> ---