Git Cheat Sheet (PDF download)

Document Sample
Git Cheat Sheet (PDF download) Powered By Docstoc
					               Git Cheat Sheet                 Branching & Merging
Documentation (http://progit.org/book/)         List:       git branch
 git help [cmd]                                 Create:     git branch testing
                                                Checkout:   git checkout testing
                                                            # work, make some commits
For SVN Users                                   Back:       git checkout master
Tracking Projects                               Merge:      git merge testing
                                                Create:     git checkout -b new-branch
 git clone url svn checkout url
                                                Delete:     git branch -d new-branch
 git pull       svn update
Create Repository                              Managing Remotes
 git init    svnadmin create repo               Clone:      git   clone url
 git add .   svn import file://repo             List:       git   remote -v
 git commit                                     Send:       git   push
                                                            git   push origin master
Files                                           Recv:       git   pull
 git add file     svn add file                              git   pull origin master
 git rm file      svn rm file                   Add:        git   remote add name url
 git mv file      svn mv file                   Fetch:      git   fetch name
Committing                                      Checkout:   git   checkout name/master
 git commit -a      svn commit                 3 Principles
Browsing                                        1. (Almost) everything is local
 git log            svn log | less              2. Git commits are snapshots
 git blame file     svn blame file              3. Branching is cheap, use it often
 git diff           svn diff | less            Next Steps
                                                  git tag name
Getting Started                                   git rebase commit
Setup                                             git cherry-pick commit
 Install:   sudo port install git-core +svn       git bisect
 Name:      git config ––global user.name \       git-svn
             "Nate Murray"                        hooks
 Email:     git config ––global user.email \      tracking branches
             "nate@xcombinator.com"               submodules
                                                  interactive staging
First Repo
                                                  squashing commits
    cd ∼
                                                  repository hosting
    mkdir -p projects/demo
                                                  patches via email
    cd projects/demo
                                                  gitjour
    git init
    git status
    ls -a
                                                                    $Revision: 1.1, $Date: August 31, 2010
    echo "version 1" > test.txt                                      Nate Murray (nmurray@xcombinator.com)
    git status                                                          See also: http://book.git-scm.com/
    git add test.txt                                                      http://git.or.cz/course/svn.html
    git status                                                 Based on Steve Taylon’s Clojure Cheat Sheet
    git commit -m "added version one"
    git status
Aliases
 st: git config –global alias.st status
 ci: git config –global alias.ci commit
 ca: git config –global alias.ca commit -a

GUI
 Commits:     gitx
 Merge:       git mergetool -t opendiff

Internals
 View Log:    git log
 Show:        git show a8dn3 # sha
 Cat:         git cat-file -p 9s2j # sha

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:164
posted:11/11/2011
language:Swedish
pages:1