Re: 'git commit .' in a subdirectory also commits staged files in other subdirectories

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

 



Hi Yuri,

On Fri, Oct 21, 2022 at 12:40:51PM -0700, Yuri wrote:
> I had several staged files in various subdirectories of the cloned
> repository tree.
>
> 'git commit .' in one of them attempted to commit all of them, not
> only the files in that subdirectory.
>
> This is a very unreasonable behavior, because while being in any
> subdirectory 'git commit .' should only affect that subdirectory, and
> not files elsewhere.

That isn't right, though I can't reproduce what you describe from your
report. Try this script out:

--- >8 ---
#!/bin/sh

rm -fr repo
git init repo
cd repo

mkdir -p dir
touch dir/c
touch a
touch b
git add a b dir/c
git commit -m "a"

date >>b
date >>dir/c

(
  cd dir

  git commit . -m "dir"
)
--- 8< ---

`repo` ends up wtih the contents of dir/c committed, but b is still
modified (and its latest changes not part of the most recent commit).

Can you share a reproduction script?

Thanks,
Taylor



[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