<file>..." to include in what will be committed) foo.txt nothing added to commit but untracked files present (use "git add" to track) Add a new file $ git status
add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: foo.txt no changes added to commit (use "git add" and/or "git commit -a") Commit a change $ git status
b/foo.txt @@ -1,6 +1,6 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis -nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Commit a change $ git diff
Insert some magic into the text commit 80ab5d44f47c0c2dbbf8ade76d4f85889295d8a4 Author: Kerry Buckley <[email protected]> Date: 10 minutes ago Add a file with some placeholder text Viewing history $ git log
Insert some magic into the text diff --git a/foo.txt b/foo.txt index e1bc2ab..d66717b 100644 --- a/foo.txt +++ b/foo.txt @@ -1,6 +1,6 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis -nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Viewing a commit $ git show 9e2546aef0232daf56635b6319bcf69f788bd5ba
Insert some magic into the text foo.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Viewing a commit $ git show --stat 9e2546aef0232daf56635b6319bcf69f788bd5ba
Insert some magic into the text 1 file changed, 1 insertion(+), 1 deletion(-) Viewing a commit $ git show --shortstat 9e2546aef0232daf56635b6319bcf69f788bd5ba
b/foo.txt @@ -1,6 +1,6 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis -nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Diff (working dir ↔ staged) $ git diff
b/foo.txt @@ -1,6 +1,6 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis -nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Diff (arbitrary references) $ git diff 80ab5d4 9e2546a
people should format commit messages. Bad commit messages can cause a number of problems: * Truncation of long lines when using git log, and other commands that understand commit commit subject/body separation * Badly-formatted emails from git format-patch * Rejection of pull requests by pedantic maintainers Good commit messages
people should format commit messages. Bad commit messages can cause a number of problems: * Truncation of long lines when using git log, and other commands that understand commit commit subject/body separation * Badly-formatted emails from git format-patch * Rejection of pull requests by pedantic maintainers Good commit messages Summary (up to ~50 chars)
people should format commit messages. Bad commit messages can cause a number of problems: * Truncation of long lines when using git log, and other commands that understand commit commit subject/body separation * Badly-formatted emails from git format-patch * Rejection of pull requests by pedantic maintainers Good commit messages Impera5ve mode (‘add’, not ‘added’)
people should format commit messages. Bad commit messages can cause a number of problems: * Truncation of long lines when using git log, and other commands that understand commit commit subject/body separation * Badly-formatted emails from git format-patch * Rejection of pull requests by pedantic maintainers Good commit messages Blank line
people should format commit messages. Bad commit messages can cause a number of problems: * Truncation of long lines when using git log, and other commands that understand commit commit subject/body separation * Badly-formatted emails from git format-patch * Rejection of pull requests by pedantic maintainers Good commit messages More info, if necessary – wrap at 72 chars
b/foo.txt @@ -1,6 +1,11 @@ +This is a file full of nonsense. + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + +Pop-up Austin mustache Tumblr Kickstarter next level scenester, typewriter +pour-over. Bespoke gentrify vegan, authentic beard fixie locavore tofu actually. Adding in patch mode $ git diff
b/foo.txt @@ -1,6 +1,11 @@ +This is a file full of nonsense. + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + +Pop-up Austin mustache Tumblr Kickstarter next level scenester, typewriter +pour-over. Bespoke gentrify vegan, authentic beard fixie locavore tofu actually. Stage this hunk [y,n,q,a,d,/,s,e,?]? Adding in patch mode $ git add -p foo.txt
a file full of nonsense. + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? Adding in patch mode Stage this hunk [y,n,q,a,d,/,s,e,?]? s
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + +Pop-up Austin mustache Tumblr Kickstarter next level scenester, typewriter +pour-over. Bespoke gentrify vegan, authentic beard fixie locavore tofu actually. Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? Adding in patch mode Stage this hunk [y,n,q,a,d,/,s,e,?]? y
HEAD <file>..." to unstage) modified: foo.txt Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: foo.txt Adding in patch mode Stage this hunk [y,n,q,a,d,/,s,e,?]? n $ git status
add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: foo.txt Untracked files: (use "git add <file>..." to include in what will be committed) bar.txt no changes added to commit (use "git add" and/or "git commit -a") Adding in interactive mode $ git status
foo.txt *** Commands *** 1: status 2: update 3: revert 4: add untracked 5: patch 6: diff 7: quit 8: help What now> Adding in interactive mode What now> s
b/foo.txt @@ -1,6 +1,11 @@ +This is a file full of nonsense. + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + +Pop-up Austin mustache Tumblr Kickstarter next level scenester, typewriter +pour-over. Bespoke gentrify vegan, authentic beard fixie locavore tofu actually. Stage this hunk [y,n,q,a,d,/,s,e,?]? Adding in interactive mode Patch update>>
a file full of nonsense. + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Stage this hunk [y,n,q,a,d,/,s,e,?]? Adding in interactive mode Stage this hunk [y,n,q,a,d,/,s,e,?]? s
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + +Pop-up Austin mustache Tumblr Kickstarter next level scenester, typewriter +pour-over. Bespoke gentrify vegan, authentic beard fixie locavore tofu actually. Stage this hunk [y,n,q,a,d,/,s,e,?]? Adding in interactive mode Stage this hunk [y,n,q,a,d,/,s,e,?]? y
-1,6 +3,9 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum + +Pop-up Austin mustache Tumblr Kickstarter next level scenester, typewriter +pour-over. Bespoke gentrify vegan, authentic beard fixie locavore tofu actually. Stage this hunk [y,n,q,a,d,/,s,e,?]? n *** Commands *** 1: status 2: update 3: revert 4: add untracked 5: patch 6: diff 7: quit 8: help What now>
foo.txt *** Commands *** 1: status 2: update 3: revert 4: add untracked 5: patch 6: diff 7: quit 8: help What now> Adding in interactive mode What now> s
HEAD <file>..." to unstage) new file: bar.txt modified: foo.txt Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: foo.txt Adding in interactive mode $ git status
<[email protected]> Date: Sun, 8 Mar 2015 09:54:31 +0000 Subject: [PATCH] Insert some magic into the text --- foo.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foo.txt b/foo.txt index e1bc2ab..d66717b 100644 --- a/foo.txt +++ b/foo.txt @@ -1,6 +1,6 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis -nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +expelliarmus wingardium leviosa expecto patronum imperio crucio avada kedavra Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum -- 2.3.1 Mailing patches
Add introductory line pick 2985b57 Add some hipster ipsum # Rebase 80ab5d4..2985b57 onto 80ab5d4 ( 3 TODO item(s)) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom. # # If you remove a line here THAT COMMIT WILL BE LOST. # # However, if you remove everything, the rebase will be aborted. # # Note that empty commits are commented out Interactive rebase $ git rebase -i 80ab5d4
to push some refs to '/Users/kerry/masterclass' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. Pushing rewritten history $ git push
some magic into the text git-svn-id: file:///Users/kerry/svn/foo/trunk@3 e0cd7379-fbe6-420c-9387-2eba09531e83 commit 16c802a2578ea71c3d96eb70cc6c5ed247883f50 Author: kerry <kerry@e0cd7379-fbe6-420c-9387-2eba09531e83> Date: 5 minutes ago Add a file with some placeholder text git-svn-id: file:///Users/kerry/svn/foo/trunk@2 e0cd7379-fbe6-420c-9387-2eba09531e83 Cloning an svn repo $ git log
replay your work on top of it... Applying: Add some hipster ipsum Using index info to reconstruct a base tree... M foo.txt Falling back to patching base and 3-way merge... Auto-merging foo.txt Pulling remote changes $ git svn rebase
r5 = af3a4e909657b619b1665bc38a224ded7ff82e07 (refs/remotes/origin/trunk) No changes between 000f0660457584cccbcac635f876c7ee56ba3846 and refs/remotes/ origin/trunk Resetting to the latest refs/remotes/origin/trunk Committing changes $ git svn dcommit