git
Learning About git
Excellent Concept Tutorial on Git
Free Online Pro Git book
Git User Manual
Git Reference
Linus Torvalds talks about git
Install Git
Git Goodies
Git Bash Completion
This is really an absolute necessity and a huge productivity improvement. Basically you need the bash completion script from the source tarball and use your shell profile to include it whenever you open a shell. See the Auto-Completion section on this page:
Git Bash Auto-Completion
GitX git GUI
GitX is an awesome FREE history viewer made for OS X. It is a better way to visualize your branch and commit history of your git repository. However, power users (aka "cool kids") will probably only use it for history viewing while they continue to use the terminal command line for checkouts, branching, staging, rebasing and committing.
GitX Home Page
Open in GitX
Git Tower
For those of you who just get panic attacks at the thought of using the Terminal, there is a commercial app for that:
Git Tower
Using git locally on a Subversion Working Copy
OK, so you are addicted to git, and now you have to work on a team project that is hosted in a remote subversion repository ... and it is making you depressed :-(. Well, you can use manage your local svn working copy using git and be happy again!
There is a git-svn tool (type man git-svn in the terminal for details), but that adds yet another tool into the mix that you have to learn. So while you could use it and YMMV for projects tht are going to be on svn forever, I recommend you just use the git+svn protocol instead, especially if you are typically working on one particular branch of the remote svn repository.
I want to learn git before I switch from Subversion
(This kind of repeats some of the previous section, but that's on purpose so we can condition you brain to start using git right now ;-) )
Even while you are working with svn repositories, you can start learning and taking advantage of git right now by making your local svn working copy an actual local git repository. The idea is to use the appropriate ignore feature of each SCM system to ignore the hidden files of the other system. The concept is described here:
When you first learn about git and you google "git svn" you will learn about a command line tool git-svn which works directly with remote svn repos. Unless you want to use git locally to switch between svn branches, I don't recommend it. Use the git+svn approach outlined in above blog post instead.
Once you start using git, it becomes addictive ....... you can never go back ...... really, it's that good ...... and it is not hard.
Some tips for Eclipse setup and general workflow when using git locally on svn working copies,
- check out the entire svn branch that you work on using the command line, then LINK (import no copy) the projects you want in your workspace using the Subclipse import tool, and
- Do your git operations (status, staging, commit, diff, branching, checkouts, rebase and merge using the terminal). git on the terminal is efficient... honest.
- Do all your local work and cimmits on branches other than the master branch.
- Switch to master branch to update from svn and commit those svn updates on the master branch.
- Merge your working branch(es) with or rebase your working branch(es) from the master and just keep on working.
- Switch to master branch before synchronizing with remote svn repo.
- You can use git stash to temporarily put aside your uncommitted changes before doing an svn update. Then use git stash pop to replay those uncommitted changes onto the working copy.
# Assume you are currently on a working branch. Verify this and check for uncommitted changes.
git status
# Either commit your local changes to your working branch
# using 'git add' + 'git commit', or temporarily stash
# them using 'git stash'
git stash
# Switch to master branch
git checkout master
# Ensure there are no changes either from an svn perspective
# or a git perspective on the master branch.
git status
svn status
# Update the master branch from remote svn repo
svn update
# Commit those updates to git repo
git commit -a -m "updated from remote svn repo"
# Switch to your working branch
git checkout workingbranch
# Merge or rebase your working branch off of the updated master.
# This rewinds your branch commits back to the common commit ancestor
# shared between your working branch and the master branch. Then it
# applies the master branch commits (the svn updates) so that this
# working branch becomes identical to the master. After that it 'replays'
# your working branch commits on top of the updated branch.
# This ensures a clean linear progression. Rebasing is a very cool feature of git.
rebase master
# Now if you stashed uncommitted changes earlier, you can pop them back into
# the working copy
git stash pop
# First perform an svn update as outlined above in the previous section
# Switch to the master branch
git checkout master
# Merge your working branch with the master
git merge workingbranch
# Use svn status, svn add and svn commit to commit your changes to the remote svn repository
# Switch back to your workingbranch and get back to work.