Skip to content

Instantly share code, notes, and snippets.

@viercc
Created July 13, 2022 05:01
Show Gist options
  • Save viercc/0d577954cc7f20abf71be3437376a909 to your computer and use it in GitHub Desktop.
Save viercc/0d577954cc7f20abf71be3437376a909 to your computer and use it in GitHub Desktop.
Using git-status to tell if it's "nothing-to-commit" status
$ ls
foobar.txt hoge.txt piyo.txt
$ git status
ブランチ main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: hoge.txt
追跡されていないファイル:
(use "git add <file>..." to include in what will be committed)
piyo.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git status --porcelain
M hoge.txt
?? piyo.txt
$ git status --porcelain | grep '^[MTADRCU]' | wc -l
0
$ git add hoge.txt
$ git status --porcelain
M hoge.txt
?? piyo.txt
$ git status --porcelain | grep '^[MTADRCU]' | wc -l
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment