Rustavore
Rustavore

Reputation: 1905

make git status show folders with modified files

I have a lot of modified files in my working tree. But I ONLY want to see what files are actually staged for commit so I don't accidentally push files that I'm still working on. How can I do this?

EDIT: Sorry for the confusion -- if there's no way to just see the staged changes, then is it possible to only see a list of folders with modified files instead of all modified files?

Upvotes: 0

Views: 518

Answers (2)

harpun
harpun

Reputation: 4110

You could parse the output of git status:

git status --porcelain | grep "^[MADRCU]" | cut -c 4-

The --porcelain option ensures backward-compatibility between different git versions and is similar to the --short output. The grep pattern handles different kinds of changes to files. See git help status for further explanation.

Upvotes: 3

Gertjan Assies
Gertjan Assies

Reputation: 1900

git status will show you both, first the files that are staged for commit, then the modified files but not staged for commit

note that new files are always staged

You should avoid too many modified files, commit early and commit often

If you have a lot of unrelated changes that you need to track you should really look into branching

Upvotes: 0

Related Questions