]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
gitconfig: Add alias to display content of untracked files (u).
authorSimon Ruderich <simon@ruderich.org>
Tue, 2 Apr 2013 03:15:26 +0000 (05:15 +0200)
committerSimon Ruderich <simon@ruderich.org>
Tue, 2 Apr 2013 03:15:26 +0000 (05:15 +0200)
gitconfig.m4

index 1977f2e67955ff47e85d4a29e2ac8b6ee353b383..1b7dc454db2d3494ca54cdd5824e0be4bc85f971 100644 (file)
@@ -127,6 +127,24 @@ include(../lib.m4)
                                \"Backup on $(date -R)\" >/dev/null \
              && git stash apply >/dev/null"
 
+       # Display list and content of untracked files. Untracked directories
+       # and symbolic links are only listed.
+       u = "! git ls-files --other --exclude-standard --directory -z \
+            | xargs -0 sh -c '\
+                  for x; do \
+                      printf \"\\033[1;33m-> %s\\033[0m:\" \"$x\"; \
+                      if test -d \"$x\"; then \
+                          echo \" directory\"; \
+                      elif test -h \"$x\"; then \
+                          echo \" symbolic link\"; \
+                      else \
+                          echo; \
+                          cat \"$x\"; \
+                      fi; \
+                      echo; \
+                  done' argv0 \
+            | less"
+
 [diff]
        # Detect copies and renames.
        renames = copy