How to open all modified files using git?

How to open all deleted, modified and created files since the last git commit, I first tried to use git status , but it was hard to parse, so I found that git status --porcelain was easier to parse and with awk + vim + some bash magic easy to do.

+8
git bash vim awk
source share
4 answers

So, I found a solution with vim :

 vim $(git status --porcelain | awk '{print $2}') 

And I am posting this question + answer, just to answer it myself and share it with the Internet

+10
source share
 git ls-files --modified --deleted --others -z | xargs -0 vim 
+4
source share

To make this work when im is in the git repo subfolder, I just use the -s option for git status. The Vim -O option opens files in vertical section.

vim -O $(git status -s | awk '{print $2}')

+4
source share

From this blog you can edit ~/.gitconfig and add this line:

 [alias] edit = !$EDITOR $(git status --short | awk '$1 ~ /^M|A|U/ {print $2}' ) 

Now git edit will open all modified files

+2
source share

All Articles