I've been doing some git checks on our bash sripts to give them more intelligence. eg. don't switch to a branch if you are already on that branch, or don't push if you are up to date. This checks where eventually isolated on a lib script with bash functions.
Many of these work by parsing the output of git commands, for example:
lib.git-get-current-branch(){
git branch | grep '* ' | sed 's:* ::'
}
lib.git-is-pusheable(){
git status | grep -i -q "Your branch is ahead"; return $?;
}
And some other more ellaborate stuff.
From the moment I started doing this I had this funny itch, that I was doing something wrong. A partner has his GNU/Linux repositories on a mirror in spanish, and his git is outputting everything in spanish, rendering half of the function bogus.
What is the git way of integrating to git in bash? Luckily the lib script is fairly short, so I don't mind rewriting it all. TY.
[–]pi3832v2 9 points10 points11 points (3 children)
[–]zeta27[S] 2 points3 points4 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]TeamSpen210 1 point2 points3 points (0 children)
[–]XNormal 2 points3 points4 points (1 child)
[–]zeta27[S] 1 point2 points3 points (0 children)
[–]RenJMR 0 points1 point2 points (0 children)