The first thing you'll want to do is make sure your ~/.gitconfig file is up to snuff. This file holds various Git preferences such as the username and email that is used for every commit. For details on how you can customize this file, see Customizing Git Configuration. For instance, I've made sure that Araxis Merge is the diff and merge tool used by Git:
[diff]
tool = araxis
[difftool]
prompt = false
[merge]
tool = araxis
[mergetool]
trustExitCode = true
A few Git aliases I like to use include:
[alias]
ci = commit
co = checkout
st = status
branches = branch
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
ls = ls-files
gblame = gui blame
source ~/.git-completion.sh
Finally, you can show what branch you're currently working on via a Git prompt script. Like the Git completion script, you'll want to create a ~/.git-prompt.sh file at your root directory and then add it to your shell startup configuration similar to the git-completion script. For example, when working on the master branch of the Librarian project, my shell prompt looks like:
[abraginsky@darthomir Librarian (master)]$
Obviously, you can configure Git in many more ways than this. Nothing beats the main documentation and a book I recommend reading is Version Control with Git.
Hopefully you've found this helpful! Feel free to post any other Git command line tips and tricks that you like to use.
Thanks to @jarjar2k7 for some of these tips.
1 comments:
Thanks for the tips. I've been using SourceTree on Mavericks without too many issues - i think it did crash on me once now that I think of it.
I started digging into my copy of oh-my-zsh and found a bunch of the things you've referenced built in there. I'm sure there are some differences in implementation, and I've not used the CLI very much for git. Only had to do CLI when something runs afoul in SourceTree - in which case, I'm sure the power of these CLI customizations shine through.
The git* oh-my-zsh plugins:
https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins
Post a Comment