Colorize bash output?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I keep all my git repositories in a single folder, and sometimes I want to get a quick status check on all of them, mostly to make sure I'm not leaving the office without pushing any commits.
I wrote a bash script to do that:
for dir in *; do if [[ -d $dir ]]; then echo "checking " $dir; cd $dir; git status; cd ../; fi; done
Which, not for nothing, revealed that I have a couple of untracked files hanging out in one repository that I hadn't realized were not properly tracked. I'm realizing that for this script to be truly awesome, it should highlight the repositories with unstaged changes or unpushed commits, because right now they don't really stand out.
Here's some sample output:
checking repository_one
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
imgs/one.jpg
imgs/two.jpg
nothing added to commit but untracked files present (use "git add" to track)
checking repostory_three
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
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: modified_thing.md
no changes added to commit (use "git add" and/or "git commit -a")
checking repository_four
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
checking repository_five
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
In my terminal, the untracked files and unstaged changes appear in red, but the rest is grey. I'd also love to highlight "Your branch is ahead of 'origin/master' by 1 commit." so I don't leave without pushing it. Can I do that in the script somewhere? Or in my theme? Anywhere?
Is there a better (or different) way to quickly scan for unstaged changes and branches that are ahead by a commit?
bash shell-script git
add a comment |Â
up vote
0
down vote
favorite
I keep all my git repositories in a single folder, and sometimes I want to get a quick status check on all of them, mostly to make sure I'm not leaving the office without pushing any commits.
I wrote a bash script to do that:
for dir in *; do if [[ -d $dir ]]; then echo "checking " $dir; cd $dir; git status; cd ../; fi; done
Which, not for nothing, revealed that I have a couple of untracked files hanging out in one repository that I hadn't realized were not properly tracked. I'm realizing that for this script to be truly awesome, it should highlight the repositories with unstaged changes or unpushed commits, because right now they don't really stand out.
Here's some sample output:
checking repository_one
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
imgs/one.jpg
imgs/two.jpg
nothing added to commit but untracked files present (use "git add" to track)
checking repostory_three
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
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: modified_thing.md
no changes added to commit (use "git add" and/or "git commit -a")
checking repository_four
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
checking repository_five
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
In my terminal, the untracked files and unstaged changes appear in red, but the rest is grey. I'd also love to highlight "Your branch is ahead of 'origin/master' by 1 commit." so I don't leave without pushing it. Can I do that in the script somewhere? Or in my theme? Anywhere?
Is there a better (or different) way to quickly scan for unstaged changes and branches that are ahead by a commit?
bash shell-script git
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I keep all my git repositories in a single folder, and sometimes I want to get a quick status check on all of them, mostly to make sure I'm not leaving the office without pushing any commits.
I wrote a bash script to do that:
for dir in *; do if [[ -d $dir ]]; then echo "checking " $dir; cd $dir; git status; cd ../; fi; done
Which, not for nothing, revealed that I have a couple of untracked files hanging out in one repository that I hadn't realized were not properly tracked. I'm realizing that for this script to be truly awesome, it should highlight the repositories with unstaged changes or unpushed commits, because right now they don't really stand out.
Here's some sample output:
checking repository_one
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
imgs/one.jpg
imgs/two.jpg
nothing added to commit but untracked files present (use "git add" to track)
checking repostory_three
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
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: modified_thing.md
no changes added to commit (use "git add" and/or "git commit -a")
checking repository_four
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
checking repository_five
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
In my terminal, the untracked files and unstaged changes appear in red, but the rest is grey. I'd also love to highlight "Your branch is ahead of 'origin/master' by 1 commit." so I don't leave without pushing it. Can I do that in the script somewhere? Or in my theme? Anywhere?
Is there a better (or different) way to quickly scan for unstaged changes and branches that are ahead by a commit?
bash shell-script git
I keep all my git repositories in a single folder, and sometimes I want to get a quick status check on all of them, mostly to make sure I'm not leaving the office without pushing any commits.
I wrote a bash script to do that:
for dir in *; do if [[ -d $dir ]]; then echo "checking " $dir; cd $dir; git status; cd ../; fi; done
Which, not for nothing, revealed that I have a couple of untracked files hanging out in one repository that I hadn't realized were not properly tracked. I'm realizing that for this script to be truly awesome, it should highlight the repositories with unstaged changes or unpushed commits, because right now they don't really stand out.
Here's some sample output:
checking repository_one
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
imgs/one.jpg
imgs/two.jpg
nothing added to commit but untracked files present (use "git add" to track)
checking repostory_three
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
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: modified_thing.md
no changes added to commit (use "git add" and/or "git commit -a")
checking repository_four
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
checking repository_five
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
In my terminal, the untracked files and unstaged changes appear in red, but the rest is grey. I'd also love to highlight "Your branch is ahead of 'origin/master' by 1 commit." so I don't leave without pushing it. Can I do that in the script somewhere? Or in my theme? Anywhere?
Is there a better (or different) way to quickly scan for unstaged changes and branches that are ahead by a commit?
bash shell-script git
bash shell-script git
asked 4 mins ago
Amanda
396113
396113
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f479032%2fcolorize-bash-output%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password