git を使用して、ステージングされていないファイルの最終更新日をそのパスと一緒にリストすることは可能ですか? 例を使用して。
git status
また
git diff --name-only
git を使用して、ステージングされていないファイルの最終更新日をそのパスと一緒にリストすることは可能ですか? 例を使用して。
git status
また
git diff --name-only
直接ではありませんが、パイプを使用できます。
注:コメントに基づいて元の回答が更新されました
Linux:
git status -s | while read mode file; do echo $mode $file $(stat -c %y $file); done
ウィンドウズ:
git status -s | while read mode file; do echo $mode $(date --reference=$file +"%Y-%m-%d %H:%M:%S") $file; done
OSX (ソース):
git status -s | while read mode file; do echo $mode $(stat -f "%Sm" $file) $file; done|sort
注: 変更されたファイルを日付順に並べ替える必要があったため、echo を次のように変更しました。
git status -s | while read mode file; \
do echo $mode $(stat -c %y $file) $file; \
done|sort -k1,4
1 行:
git status -s | while read mode file; do echo $mode $(stat -c %y $file) $file; done|sort -k1,4
最初に日付 ( stat
) をエコーし、次にファイルをエコーすることで、変更が古いものから新しいものへと並べ替えることができました。
Sam Haslerはコメントに次のように追加します。
モードでスペースを保持するには:
IFS=''; git status -s | while read -n2 mode; read -n1; read file; do echo $mode $(stat -c %y "$file") $file; done|sort
あれは:
IFS=''; git status -s | while read -n2 mode; read -n1; read file; \
do echo $mode $(stat -c %y "$file") $file; \
done|sort