It’s more than a year now since I started using GIT and I can say that is the best versioning system ever invented.
It’s fast, really fast. And clean. I used SVN at the univ and it was a bloody pain. Merging branches was awful and it easily got messed although it was just two of us working on the same project.
Now we are three from 6 different machines and everything is just a piece of cake.
You pull in the morning. Commit your changes every now and then. And push in the evening.
No fuss no pain.
Just nicely simple.
As I’m a console guy, I came up with a nice configuration for my bash prompt that tells me what’s going on with the project.
I thought it would be nice to share it with you. Here it is:
First add the following functions to your .bash_profile or .bashrc or, if you are a really clean guy, to your .bash_functions
-
function parse_git_branch_and_add_brackets {
-
branch=$(git branch –no-color 2> /dev/null | sed -e ‘/^[^*]/d’ -e ‘s/* \(.*\)/\1/’)
-
repo=$(git config –get "branch.$branch.remote" 2> /dev/null)
-
echo " ["$branch"@"$repo"]" | sed -e ‘/^\ \[@\]/d’
-
}
-
-
function parse_git_status {
-
status=$(echo `git status -s 2> /dev/null | awk ‘{print $1;}’ | sort | uniq -c | sed -e "s/??/U/g" | sed -E "s/([0-9]*)\ ([A-Z])/\1\2/"`)
-
status=$(echo "("$status")" | sed -e "/^()$/d")
-
-
ahead=$(git status 2> /dev/null | grep ahead | awk ‘{print $9;}’)
-
ahead=$(echo "{"$ahead"}" | sed "/^{}$/d")
-
-
echo -e "\033[01;32m"$status"\033[01;0m""\033[01;31m"$ahead"\033[01;0m"
-
}
Then edit your .bashrc (or .bash_profile depending on your distro) and find the line where the variable PS1 is defined. Once found, change it as follows:
-
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[00;34m\]\w\[\033[1;33m\]$(parse_git_branch_and_add_brackets)\[\033[0m\]$(parse_git_status) \$ ‘
If you are on a Mac (and I really hope for you that you are :þ) the line is the following:
-
PS1=‘\h:\W \u\[\033[1;33m\]$(parse_git_branch_and_add_brackets)\[\033[0m\]\[$(parse_git_status)\] \$ ‘
And that’s it.
Now your prompt should look as the following:
GIT powered BASH prompt
The part between square brackets are the branch and the repo. The part between the round brackets is the status of your working folder at the moment. The part between the curly brackets is how many commits you are ahead of the master branch.
In my case the branch is master and the repo is origin. I have one file added but not yet committed (A), one file untracked (U) and one file modified (M). And I’m one commit ahead of the master.
Useful, isn’t it?
[update]
There was a small bug in the parse_git_status function. I added a sort before the uniq so that it properly groups the changes.
[/update]
Something so geekly beautiful that will certainly (?) please you :D
The sound of sorting
On several years, along with others, I bear been studying the worldwide blast in higher tutoring in both developing and developed nations. These studies authenticate that the rates at which prepubescent men, and singularly uninitiated women, have been graduating from universities have accelerated in bordering on every countryside during the days 30 years. China, in return example, has xanax without prescription had a rise in enrollments at universities of both children men and women since close to 1990, and a on the qui vive evolvement since the new 1990s. A almost identical prompt spread of higher education has also occurred in diverse other silence developing countries, such as South Korea. Developed countries too arrange broadly also greatly increased enrollments at universities, although the US has fallen behind in the fraction of progeny men who go out on from weighty alma mater to inherit a college education.
Kudos!
For all the fans of desktop ballistics.
Behold the power of Mini Cannon!
Mini Cannon
Quite a dangerous toy…
From Tristan Perich (the author) website:
1-Bit Symphony is an electronic composition in five movements on a single microchip. Though housed in a CD jewel case, 1-Bit Symphony is not a recording in the traditional sense; it literally “performs” its music live when turned on. A complete electronic circuit—programmed by the artist and assembled by hand—plays the music through a headphone jack mounted into the case itself.
Mother Earth is on the brink of extinction and has released her last defence, the Great Death Worm Wojira.
Not enough? Ok! Plenty of NES-style pixelated graphic. A such bad-ass monster that not only destroys planes (even Mega Shark can do that) but satellites too.
Are you drooling yet? I am. And I can’t wait the release (end of the month).
Great Death Worm Wojira
Deceased Pixel official website. Via Cult of Mac.









































































