ステージングされたファイル名のみのリストを取得したいと思います。コマンド--name-only
の同等のフラグが見つかりません。git status
良い代替手段は何ですか?
ファイルリストはphp -l
(PHP lint 構文チェッカー) にパイプされます。
解決策: 完全なコマンド
git diff --name-only --cached | xargs -l php -l
ステージングされたファイル名のみのリストを取得したいと思います。コマンド--name-only
の同等のフラグが見つかりません。git status
良い代替手段は何ですか?
ファイルリストはphp -l
(PHP lint 構文チェッカー) にパイプされます。
解決策: 完全なコマンド
git diff --name-only --cached | xargs -l php -l
使用git diff --name-only
(--cached
ステージングされたファイルを取得するために)
受け入れられた回答では、どのような変更があったかはわかりません。
はい、構文チェッカーではなく、ステージングされていないファイルでいっぱいのリポジトリを持つ普通の人で、ステージングされたファイルがどうなるか知りたい場合は、別のコマンドがあります。
git status --short | grep '^[MARCD]'
次のような結果になります。
M dir/modified_file
A dir/new_file
R dir/renamed -> dir/renamed_to
C dir/copied_file
D dir/deleted_file
明らかに、このファイルはステージングされ、git commit
:
deleted_file
が削除され、
new_file
追加され
renamed_file
、renamed_to
.
短い形式の出力の説明は次のとおりです: https://git-scm.com/docs/git-status#_short_format
@ coffman21の回答に触発されて、次のエイリアスを設定しました.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 '^??'"
また
alias gst="git status"
alias staged="git status --short | grep '^\w.'"
alias unstaged="git status --short | grep '^\W.'"
alias unstaged-tracked="git status --short | grep '^\s.'"
alias untracked="git status --short | grep '^??'"
それは他の誰かに役立つかもしれません。したがって、それを回答のスタックに追加します。