git

Git Quick Reference Guide

Create git repository:cd /path/to/repo && git init

Checkout a repositoy:git clone user@host:/path/to/repo

Change branch:git checkout -b [branchname]

Add files to local copy of repository:git add [filename] # can use wildcards

List files in local repository:git ls-tree --full-tree -r HEAD

Commit changes to local repository:git commit -am "Message"

Push changes to existing remote repo:git push origin master

Push changes to new remote repo:git remote add origin username@host

Tagging commits (e.g, software releases):git log && git tag [tag] [commit-id]

Replace local borked file with remote copy:git checkout -- [filename]

Reset local repo with remote:git fetch origin && git reset --hard origin/master

Colorize git output:git config color.ui true

Sources:
http://gitready.com/ (Beginner Sections)

http://rogerdudler.github.io/git-guide/

http://stackoverflow.com/questions/8533202/list-files-in-local-git-repo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s