git config --global user.name "Mark Gardner"
git config --global user.email mark.gardner@jwt.com
git config -l
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
git clone URL
git pull
git checkout PATH
How to have git log show filenames like svn log -v
git log git blame FILE
git log --name-status git log --name-only git log --stat git whatchanged
git log --pretty=oneline
git log --oneline --abbrev=8 -n 3
git log --abbrev=8 -n 3 --reverse
git log --pretty=format:%h -n 3
git log --pretty="format:%h %ai" -3 --reverse
git log --pretty="format:%h %ai %b" --since=2000 -3 --reverse
git log --pretty="format:%h %ai %b" --all -3 --reverse
How to show first commit by ‘git log’?
$ git log $(git log --pretty=format:%H|tail -1) commit 845ee14203f8358edc22df73b3d4fb7529bc50dc Author: alex <alex@bd03fe64-2323-4976-ad70-d729f554425a> Date: Tue Jul 1 19:12:53 2008 +0000
standard svn trunk/tags/branches
git-svn-id: https://services.eye.fi/svn/apps/trunk@1 bd03fe64-2323-4976-ad70-d729f554425a
$ $ git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$" 845ee14203f8358edc22df73b3d4fb7529bc50dc $ git log 845ee14203f8358edc22df73b3d4fb7529bc50dc commit 845ee14203f8358edc22df73b3d4fb7529bc50dc Author: alex <alex@bd03fe64-2323-4976-ad70-d729f554425a> Date: Tue Jul 1 19:12:53 2008 +0000
standard svn trunk/tags/branches
git-svn-id: https://services.eye.fi/svn/apps/trunk@1 bd03fe64-2323-4976-ad70-d729f554425a
$ $ git rev-list --parents HEAD | egrep "^[a-f0-9]{40}$" | git name-rev --stdin 845ee14203f8358edc22df73b3d4fb7529bc50dc (remotes/tags/android_translations_083111~3265) $ git log 845ee14203f8358edc22df73b3d4fb7529bc50dc
$ git log $(git log --pretty=format:%H|tail -3) --reverse commit 845ee14203f8358edc22df73b3d4fb7529bc50dc Author: alex <alex@bd03fe64-2323-4976-ad70-d729f554425a> Date: Tue Jul 1 19:12:53 2008 +0000
standard svn trunk/tags/branches
git-svn-id: https://services.eye.fi/svn/apps/trunk@1 bd03fe64-2323-4976-ad70-d729f554425a
commit 4e7baa0ea019f443e550d9de650cb4b31fefc4e9 Author: shawn <shawn@bd03fe64-2323-4976-ad70-d729f554425a> Date: Tue Jul 8 01:17:56 2008 +0000
initial checkin for tester web app
git-svn-id: https://services.eye.fi/svn/apps/trunk@2 bd03fe64-2323-4976-ad70-d729f554425a
commit 20dae4e32bc47755854da05f4388176f95e9f5b1 Author: shawn <shawn@bd03fe64-2323-4976-ad70-d729f554425a> Date: Thu Jul 10 22:45:30 2008 +0000
move facebook app code into apps trunk
git-svn-id: https://services.eye.fi/svn/apps/trunk@3 bd03fe64-2323-4976-ad70-d729f554425a
git diff
git show // Show diff for each file that's changed. git show HASH // Show diff for each file that's changed since that hash revision
git tag -a TAG_NAME git tag -l git show TAG_NAME
git branch BRANCH_NAME git checkout BRANCH_NAME
git merge BRANCH_NAME
git cherry-pick REV
git init
git add .
git commit
git clone --bare REPO_PATH REPO.git
touch REPO.git/git-daemon-export-ok
* master
branches
hotfix
release
tags
git: the fast version control system
Git – SVN Crash Course
@grmpyprogrammer
Podcast: /dev/hell
Blog: @TheKeyboard
The Grumpy Programmer’s Guide to Building Testable PHP Applications
PHPUnit Aborted Fix
$ git commit --amend
... use previous messages as template ... $ git commit --amend -c HEAD
... use previous message w/o prompt ... $ git commit --amend -C HEAD
... amend alias ... $ git amend -c HEAD $ git amend -C HEAD
Rebasing changes commit IDs and is fine if local only. Sharing rebased repos requires each received share to be rebase to fix the situation.
Replays commits on top of another commit.
$ git checkout other $ git rebase master
... rebase interactive ... $ git rebase -i c9161f3 ... launches editor ...
$ git log --oneline --graph --all
$ git rebase --continue
... Fixing First Commit ... $ git log --oneline
$ git rebase -i ... reset current commit to prior commit ... $ git reset HEAD^ $ git commit --amend -a $ git rebase --continue $ git log --oneline
Move a commit to somewhere else in the history.
Orphans are held for two weeks.
$ git log --oneline $ git rebase --onto HEAD^^^ > HEAD^^ master $ git log --oneline --all
$ git reset --hard ORIG_HEAD ... goes back before the rebase ... $ git branch other c8ceb23 $ git rebase --onto 84cbfcc > other master
$ git log --oneline
$ git bisect start <bad>
$ git bisect end HEAD
$ git bisect run ../test-repo
$ git bisect reset
travisswicegood.com
tswicegood
travis
domain51.com
Rebases a remote branch
$ git filter other
... delete branch ...
$ git branch -d other
... force delete branch ...
$ git branch -D other