Re: Minor UX annoyance w/`git add --patch untracked/file`

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

 



On Thu, Nov 30, 2023 at 11:26:37AM -0800, Vito Caputo wrote:

> Couldn't the following two steps be done automagically by --patch:
> 
> ```
> git add -N path/to/untracked/file/wishing/to/partially/add
> git add --patch path/to/untracked/file/wishing/to/partially/add
> ```
> 
> when one simply does:
> 
> `git add --patch path/to/untracked/file/wishing/to/partially/add`
> 
> ?

They _could_, but keep in mind that the argument is not strictly a path.
It is a pathspec that may match multiple paths. So:

  git add -p path/to/

for example will pick up the tracked files in path/to/, but not your
untracked one.

It would be possible to distinguish the two cases, and only auto-add
files which are explicitly mentioned as full paths. But we usually shy
away from too many special cases like this, as the resulting behavior
can end up confusing and hard to explain.

-Peff




[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