[英]git status print Untracked files first
在執行git status
時是否可以將git配置為首先打印未跟蹤的文件? 當前,執行git status
時的打印輸出如下所示。 注意:我不想使用忽略功能。 所有未跟蹤的文件都應打印。
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: somefile.c
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: anotherfile.c
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Alot of files.
# .
# .
# .
如果有可用的sort
命令以反向排序,則可以嘗試以下操作:
git status --short | sort -r
在msysgit 1.9.0中給出以下輸出:
?? foo.txt
M hello.scala
在上面的輸出中,未跟蹤的文件顯示為??
在他們之前。 如文檔所述 :
對於未跟蹤的路徑,XY為??。
還要注意的是,短期形式--short
標志是-s
,所以這也可以使用:
git status -s | sort -r
如果需要,您甚至可以將其轉換為git別名:
git config --global rstatus "!git status --short | sort -r"
# Usage
git rstatus
或者,您可以在Bash配置中定義一個別名:
alias gsr='git status --short | sort -r'
# Usage
grs
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.