How to make git status show only staged files

后端 未结 4 609
野趣味
野趣味 2020-11-30 23:56

I would like to get a list of only the staged filenames. I can\'t find the equivalent flag for --name-only for the git status command. What is a go

4条回答
  •  感动是毒
    2020-12-01 00:33

    Inspired by @coffman21's answer I have setup the following alias in my .zshrc

    alias gst="git status"
    alias gst-staged="git status --short | grep '^\w.'"
    alias gst-unstaged="git status  --short | grep '^\W.'"
    alias gst-unstaged-tracked="git status  --short | grep '^\s.'"
    alias gst-untracked="git status --short | grep '^??'"
    

    It might be of use to anyone else. So adding it to the stack of answers.

提交回复
热议问题