Re: Sponsoring request: maxflow initial upload
On Wed, 2015-07-22 at 07:54 +0200, Andreas Tille wrote:
> Grrr, I seem to stand with one leg in SVN world where a commit just goes
> remote. Sorry, done now.
My remedy for this is:
If your using bash, add this function to your .bashrc:
parse_git_state() {
gstate=$(LC_ALL='C' git status 2>/dev/null)
if [ "x$gstate" = "x" ]; then
return
fi
state_up=$(echo $gstate | grep "Your branch is ahead" >/dev/null \
&& echo "^")
state_ci=$(echo $gstate | grep "nothing.*to commit" >/dev/null \
|| echo "*")
state_add=$(echo $gstate | grep "ntracked files" >/dev/null \
&& echo "+")
state_branch=$(echo $gstate | \
sed -e 's/^On branch \([a-zA-Z0-9_]*\).*/\1/')
echo "|git:$state_branch$state_ci$state_up$state_add"
}
and add somewhere in your PS1 prompt $(parse_git_state)
With this, when you are in a git managed directory tree it will show you
the branch and some state information:
* = uncommitted changes
+ = files that are not tracked
^ = branch ahead of remote (i.e. push required)
best,
Gert
Reply to: