Re: PATCH: improve git switch documentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin wrote:
> On 10/07/2021 21:45, Felipe Contreras wrote:
> > Martin wrote:
> > No. You can add all the explanation you want after "Resets the branch to
> > <head>.", but most of that explanation would be redundant, because as we
> > already agreed, there's no way to reset the head of a branch without
> > changing the branch.
> 
> By that logic a lot of explanations are redundant, because on some 
> lever, if every user thinks far enough lots of things can be concluded.

Yes. And that's what a good writer aims for: to minimize the number of
words needed for the vast majority of readers to understand the point.

The more work you as a writer put into a sentence, the less work
hundreds or thousands of readers have to do while reading that sentence.

Rendundancy is only good when you are trying to reach a certain
word count for a university essay.

>  From the docs (and similar on git checkout)
> > --force
> > 
> >     An alias for --discard-changes.
> > --discard-changes
> > 
> >     Proceed even if the index or the working tree differs from HEAD.
> > Both the index and working tree are restored to match the switching 
> > target. If --recurse-submodules is specified, submodule content is 
> > also restored to match the switching target. This is used to throw
> > away local changes.

There's no adjective I can use for the official git documentation that
isn't crass, so let's just say that I find it extremelly lacking.

That paragraph above is a great example: it's a) hard to read, b)
unecessarily verbose, c) is wrongly ordered, d) redundant, and e) not
even correct.

> If the working tree is made to match the target, then it can not retain 
> local changes. That can be concluded.
> Yet, it is explicitly mentioned.
> 
> Does it really hurt to mention it?

Yes it does.

Time is the most precious resource we all have. We should not waste the
most precious resource of our readers.

  Throw away local changes.

That does a much better job.

If you want to be more explicit, you can add a bit more information:

  Throw away local changes either in the staging area or the working
  tree.

Why does the user have to know what HEAD is? And why does it matter that
the staging area is held in a file called "index"?

The current explanation is just bad.


But as I said, if you want to replicate the current style of the
documentation, go ahead, but it would be pretty much a bloated version
of "resets the branch to <head>".

> But anyway.
> I brought forward my idea. I explained my reasoning.
> If it (this part) is downvoted/rejected then that it how it is.

It's not a matter of consensus. There are proposals where literally
everyone is in favor, and yet they are never merged.

There's only one person you need to convince.

So, what I suggest you to do is take into consideration all we have
discussed and send another patch, because that's ultimately all that
matters. Moreover, it usually happens to me that while I write the patch
is when finally the previously-discussed ideas start to click.

> >>>> So, I still ask:
> >>>> - If "--force" to overwrite the work tree can clearly state that change
> >>>> to files will be "thrown away".
> >>>> - Then why can "force" re-using an existing branch name not do the same?
> >>>
> >>> Because we would be forcing two things now.
> >>
> >> Which 2 things?
> >>
> >> The worktree overwriting is *not* forced by -C
> >>
> >>     git switch -C b1 b2
> >>     git checkout -B b1 b2
> >>
> >> both give an error if the worktree has changed files.
> >>
> >> This is only about what happens to the branch.
> >>
> >> I.e we force the branchname to point to our new branch.
> >> And that means the branchname no longe points to the old branch, and the
> >> old branch therefore is removed.
> > 
> > It seems your proposal is to make `git switch -c --force b1 b2` be the same as
> > `git switch -C b1 b2`, but that would also make it the same as
> > `git switch -C --force b1 b2`. Therefore it would be forcing two things.
> > 
> > Or is your proposal something else?
> > 
> 
> No. I definitely want to keep those 2 apart from each other.
> 
> For each force-needing action, you should have to specify it's own force 
> flag.

OK, but I don't see the concrete proposal. What would be the flag that
makes -c "forceful"?

Cheers.

-- 
Felipe Contreras



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux