Git on Mac
Two things that I have found really useful when working with Git on a mac:
First autocomplete in terminal. When I started using Git I used the client program Github for mac, but because I found it too buggy i switched to only using the terminal. This also gives you a better understanding of what's going on. But the problem was I could not autocomplete git commands. Luckily this was really simple to add this feature.
Download this script and save it as git-completion.bash
https://github.com/git/git/raw/master/contrib/completion/git-completion.bash
Add the file to your .bash_profile
source ~/git-completion.bash
Then make some shortcut alias in .gitconfig
1 | [Alias] |
1 | st = status |
1 | co = checkout |
1 | br = branch |
1 | ci = commit |
1 | rb = rebase |
Remember to restart you terminal (or open a new window).
Another very useful thing is to show you working branch in the prompt. Here you just have to change your PS1 in .bash_profile. There are many ways to do this and some really nice ones are shown here:
http://asemanfar.com/Current-Git-Branch-in-Bash-Prompt
I don't see a reason to put the hostname (computername) in the prompt, so after some modification I ended up with this: