Git in a nutshell

I’ve been using Clearcase for version control on large development projects now for several years (maybe as many as 10 years). I’d heard of the new trend in distributed version control but even outside of work, at home, I had been using cvs and then more recently, subversion.

I just started working with on some code that was using Git, and so I’m having my first taste of using a distributed vcs.

Here’s my cheatsheet for the essentials:

Add new files and/or updated files to the changeset to be included in the next commit (‘.’ is recursive, ‘*’ is wildcard for this dir only):

git add .

Take a snapshot of all changes staged (previously staged with git add)

git commit

Commit changes with a commit message:L

git commit -m "commit message"

Update text of a commit message that was incorrect:

git commit --amend -m "new message"

Push currently committed code to a remote git repo (if using one):

git push [remote name]