I ran the command "git reset", but my unstaged changes were put into folders instead. I get something like the following after running git status:
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: file1
modified: file2
modified: file3
modified: file4
modified: file5
Untracked files:
(use "git add <file>..." to include in what will be committed)
folder1
folder2
folder3
folder4
Each of the folders contains multiple files which I modified, but were for some reason grouped into these folders.
I need to separate these changes into multiple pull requests, so "git commit -a" won't do.
The best solution I see is to "git add -all", copy the "git status", and "git reset" again, but that seems like a lot of effort.
Is there a better solution?
Git only tracks files (not folders / directories).
However, for optimization purposes, git status
reports untracked files within a sub-directory / folder using an abbreviated format, if possible.
To de-abbreviate, use git status -uall
(that's -u
+ all
, as in "show me all the files, not a shortened list"). You can also write -uno
meaning show no files, or just -u
which means -uall
anyway. The default is -unormal
, which is the normal abbreviated version.
You can add any individual file, e.g.:
git add folder1/foo.txt
and now that file is tracked, and git status
can no longer abbreviate: it must list all still-untracked files in folder1/
one at a time, since folder1/foo.txt
is tracked.