summaryrefslogtreecommitdiff
path: root/bash/git.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/git.bash')
-rw-r--r--bash/git.bash8
1 files changed, 8 insertions, 0 deletions
diff --git a/bash/git.bash b/bash/git.bash
new file mode 100644
index 0000000..365eac2
--- /dev/null
+++ b/bash/git.bash
@@ -0,0 +1,8 @@
+# vi:syntax=sh
+
+function get_git_state () {
+ local GIT_STATUS=$(git status -bs)
+ local GIT_BRANCH=$(echo $GIT_STATUS | grep "^## :")
+ local GIT_CHANGED=$(echo $GIT_STATUS | grep -c "^ M")
+ local GIT_UNTRACKED=$(echo $GIT_STATUS | grep -c "^??")
+}