Head over to the main git website and download the appropriate git for your OS. Or you could do one of the following:
sudo apt-get install git or
sudo yum install git
brew install git or just download the client.
Windows: The easiest thing is to use Chocolatey and run
cinst git. Powershell users can also install posh-git:
If you wanted to get started with a rapid immersion course on git, I recommend Git Immersion. It’s a lengthy tutorial, but it’s worth it. You’ll get a handle on how to work with git as well as guidance on a few of the trickier features.
Los Techies has a multi-part series: Git for Windows Developers.
Hosting Your Code
- github will host open source repositories for free and private repos for a small fee – I think we pay $25 a month for 10 private repositories over at Brent Ozar Unlimited.
- bitbucket will host private repos for free, obviously that’s in someone else’s control.
You can also self-host git through a variety of mechanisms.
Making Git Even Better
On its own, git is a pretty nice version control system. It has some features that can be a bit tricky to work with or remember at first. For that reason, I like to give myself a helping hand on the prompt with a few modifications.
One of the first things I do with any new workstation is install git-completion. Git-completion is a set of auto-complete suggestions for the linux shell. Even if you aren’t using bash, there’s a git-completion for powershell, too, that you can easily install withChocolatey. Truthfully, on Windows I’d just install the whole thing via Chocolately.
Git makes the most sense on the prompt, so Visual Studi/IDE oriented developers may want to start on the command line before moving over to working within the IDE. With Git integration a native part of Visual Studio 2013, it’s going to become more important for developers to understand the best ways to work with git and with their dev tools of choice.
Git allows for a tremendous amount of customization through the gitconfig file in your home directory. Just for a taste, here’s what mine looks like:
Agile developers may even want to use git standup to produce a daily summary of activity.
There’s a world of advanced tips out there, like using
git stash to hide local changes before pulling down updates.