Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: show all modified files - staged and not staged

Tags:

git

I need a command which gives me all modified files - this includes staged (i.e. newly added files) and non-staged changes - in a plain list which I can use in a script. While this question might sound familiar I only find commands that come close to what I want to do:

git ls-files -m

.. lists (non staged) modifications but ignores staged and newly added files

git diff --name-only

.. will also only list non staged modifications

git diff --name-only --cached

.. lists only staged modifications but omits files with non-staged modifications

git status --porcelain --untracked-files=no

.. outputs all files I want to see but adds the status

I could play with git status of course and cut the first entry but since I want to integrate this command in a CMake script which will be used on windows, too. So one single command would be fine..

like image 992
frans Avatar asked Oct 12 '16 09:10

frans


1 Answers

git diff --name-only HEAD

looks like what I'm looking for - but I'm not sure yet. If someone comes up with some elaboration I'll take his/her answer :)

like image 70
frans Avatar answered Oct 18 '22 16:10

frans