0

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?

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks, worked for me edit: -uno didn't, but just -u did
@user2605633: oops, braino, it's -uall! Will fix answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.