We have modified files in path/to/another/
and path/to/main/
.
Files in path/to/main/
already added into git cache but we have updated path/to/main/Bar.php
file AGAIN. We now have the following situation:
$ git status
[...]
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: path/to/main/Foo.php
modified: path/to/main/Bar.php
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: path/to/main/Bar.php
modified: path/to/another/Aaa.php
modified: path/to/another/Bbb.php
(note that path/to/main/Bar.php shows up twice)
I need a command which could readd files which were added before without using particular paths.
P.S. git add --update
will add all these files. It doesn't work.
P.P.S. This command should be able to readd modified:
and new file:
types.
UPD1
Thanks to @AyonNahiyan, yeah, it can work in bash. But maybe there is a command without using bash tricks (subcommands).
git reset
thengit add
s again – Commongit reset
your will lost files list. It doesn't work. – Traylorgit add
. – Traylorgit reset
will drop files from "stage". Let's imagine we have 20 files in different directories. It's a disaster. :) – Traylorgit reset -- path/to/main/Bar.php
if you only want to remove a single file. Thengit add path/to/main/Bar.php
again. – Common