Git and GitHub
The unabridged story
BUT FIRST A WORD FROM OUR SPONSOR
BUT FIRST A WORD FROM OUR SPONSOR
BUT FIRST A WORD FROM OUR SPONSOR
HAPPY BIRTHDAY DANA!
Git
The stupid content tracker
What is Git, really?
Intelligence Check
Intelligence Check
Subversion is a smart database of file differences
Intelligence Check
Subversion is a smart database of file differences

  Unfortunately, this makes it quite complex
Intelligence Check
Subversion is a smart database of file differences

  Unfortunately, this makes it quite complex

Git is...
Intelligence Check
Subversion is a smart database of file differences

  Unfortunately, this makes it quite complex

Git is...
Intelligence Check
Subversion is a smart database of file differences

  Unfortunately, this makes it quite complex

Git is...
Intelligence Check
Subversion is a smart database of file differences

  Unfortunately, this makes it quite complex

Git is...
Git Isn’t Really an SCM
Git Isn’t Really an SCM
Git does Source Code Management and
Git Isn’t Really an SCM
Git does Source Code Management and

 Peer to peer content distribution
Git Isn’t Really an SCM
Git does Source Code Management and

 Peer to peer content distribution

 Document database
Git Isn’t Really an SCM
Git does Source Code Management and

 Peer to peer content distribution

 Document database

   Di...
Git Isn’t Really an SCM
Git does Source Code Management and

 Peer to peer content distribution

 Document database

   Di...
Git Isn’t Really an SCM
Git does Source Code Management and

 Peer to peer content distribution

 Document database

   Di...
The Plusses of
a Simple Design
The Plusses of
a Simple Design
It was designed to manage the development of the
Linux kernel (a very large code base)
The Plusses of
a Simple Design
It was designed to manage the development of the
Linux kernel (a very large code base)

  G...
The Plusses of
a Simple Design
It was designed to manage the development of the
Linux kernel (a very large code base)

  G...
The Plusses of
a Simple Design
It was designed to manage the development of the
Linux kernel (a very large code base)

  G...
SOMETIMES YOU HAVE A TOILET IN YOUR YARD
SOMETIMES YOU HAVE A TOILET IN YOUR YARD
AND WHO WANTS THAT, REALLY?
The Minuses of
the Toolkit Design
The Minuses of
the Toolkit Design
Git provides a ton of commands to interact with it
The Minuses of
the Toolkit Design
Git provides a ton of commands to interact with it

  The “porcelain” commands are the o...
The Minuses of
the Toolkit Design
Git provides a ton of commands to interact with it

  The “porcelain” commands are the o...
The Minuses of
the Toolkit Design
Git provides a ton of commands to interact with it

  The “porcelain” commands are the o...
Installing and Configuring
IF YOU BUILD IT, THEY WILL COME
IF YOU BUILD IT, THEY WILL COME
IF YOU BUILD IT, THEY WILL COME
SOMETIMES YOU JUST HAVE TO INSTALL A RIDICULOUS ROBOT
OFFICIAL SITE: HTTP://GIT-SCM.COM/
THERE ARE BINARIES FOR SOME PLATFORMS
OFFICIAL SITE: HTTP://GIT-SCM.COM/
THERE ARE BINARIES FOR SOME PLATFORMS
OFFICIAL SITE: HTTP://GIT-SCM.COM/
THERE ARE BINARIES FOR SOME PLATFORMS
THE INSTRUCTIONS I USE TO BUILD ON MAC OS X
THESE SIDESTEP THE DOCUMENTATION AND MACPORTS REQUIREMENTS
THE INSTRUCTIONS I USE TO BUILD ON MAC OS X
THESE SIDESTEP THE DOCUMENTATION AND MACPORTS REQUIREMENTS
Git is still young and
growing fast (update to 1.7)
[user]
                     name = James Edward Gray II
                     email = james@graysoftinc.com
               ...
[user]
                     name = James Edward Gray II
                     email = james@graysoftinc.com
               ...
[user]
                     name = James Edward Gray II
                     email = james@graysoftinc.com
               ...
[user]
                     name = James Edward Gray II
                     email = james@graysoftinc.com
               ...
set   mainfont {Monaco 12}
             set   textfont {Monaco 12}
             set   uifont {"Monaco Bold" 12}
          ...
# Git
                      alias g="git status"
                      alias ga="git add"
                      alias gaa=...
# Git
                      alias g="git status"
                      alias ga="git add"
                      alias gaa=...
# Git
                      alias g="git status"
                      alias ga="git add"
                      alias gaa=...
Memorize all of That?
Memorize all of That?

There’s a new trend to store your “dotfiles” online
Memorize all of That?

There’s a new trend to store your “dotfiles” online

  This makes it easy to move them
Memorize all of That?

There’s a new trend to store your “dotfiles” online

  This makes it easy to move them

  Plus we ca...
Memorize all of That?

There’s a new trend to store your “dotfiles” online

  This makes it easy to move them

  Plus we ca...
Memorize all of That?

There’s a new trend to store your “dotfiles” online

  This makes it easy to move them

  Plus we ca...
Staging and Commits
DANA IS SAD
DANA IS SAD
DANA IS SAD
HER CRAFT ROOM IS TRANSITIONING INTO A NURSERY
STAGING A CHANGE, THEN COMMITTING
THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
GIT STATUS




                                                     GIT ADD .

                                           ...
GIT STATUS




                                                     GIT ADD .

                                           ...
GIT STATUS




                                                     GIT ADD .

                                           ...
GIT STATUS




                                                     GIT ADD .

                                           ...
GIT STATUS




                                                     GIT ADD .

                                           ...
GIT DATA IS SHARED BY THREE AREAS
THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
THE WORKING DIRECTORY




GIT DATA IS SHARED BY THREE AREAS
THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
THE INDEX
                                                   OR
                                              STAGING AREA...
THE REPOSITORY




GIT DATA IS SHARED BY THREE AREAS
THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
GIT INCLUDES POWERFUL INSPECTION TOOLS
A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
GIT LOG




                                                          GIT SHOW 96987

                                    ...
GIT LOG




                                                          GIT SHOW 96987

                                    ...
GIT LOG




                                                          GIT SHOW 96987

                                    ...
GIT LOG




                                                          GIT SHOW 96987

                                    ...
GIT LOG




                                                          GIT SHOW 96987

                                    ...
GIT LOG




                                                          GIT SHOW 96987

                                    ...
Branching and Merging
YOU CAN ADD BRANCHES TO ANYTHING
YOU CAN ADD BRANCHES TO ANYTHING
YOU CAN ADD BRANCHES TO ANYTHING
A KID, YOUR SOURCE CODE, OR WHATEVER
Using Git without branches
is like buying condoms
and not having any sex
GIT WAS MADE TO BRANCH, LITERALLY!
WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
GIT WAS MADE TO BRANCH, LITERALLY!
WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
GIT WAS MADE TO BRANCH, LITERALLY!
WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
GIT WAS MADE TO BRANCH, LITERALLY!
WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
THE INCLUDED GITK SHOWS BRANCHES
PASS THE --ALL FLAG TO SEE BRANCHES YOU AREN’T CURRENTLY ON
THE INCLUDED GITK SHOWS BRANCHES
PASS THE --ALL FLAG TO SEE BRANCHES YOU AREN’T CURRENTLY ON
GIT MERGE PULLS THE NAMED BRANCH IN
UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
GIT MERGE PULLS THE NAMED BRANCH IN
UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
GIT MERGE PULLS THE NAMED BRANCH IN
UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
GIT MERGE PULLS THE NAMED BRANCH IN
UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
THE HISTORY SHOWS THE INCORPORATED BRANCH
EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
THE HISTORY SHOWS THE INCORPORATED BRANCH
EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
THE HISTORY SHOWS THE INCORPORATED BRANCH
EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
THE HISTORY SHOWS THE INCORPORATED BRANCH
EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
REBASE CAN BE USED TO FLATTEN THE HISTORY
YOU CAN CHOOSE TO ADD A BRANCH ONTO THE END OF ANOTHER BRANCH
REBASE CAN BE USED TO FLATTEN THE HISTORY
YOU CAN CHOOSE TO ADD A BRANCH ONTO THE END OF ANOTHER BRANCH
REBASE CAN BE USED TO FLATTEN THE HISTORY
YOU CAN CHOOSE TO ADD A BRANCH ONTO THE END OF ANOTHER BRANCH
NOW THE MERGED HISTORY IS JUST A FLAT LINE
GIT REPLAYED OUR CHANGES ONTO THE END OF THE MASTER BRANCH
With Git, it’s never too late
to branch!
YOU CAN STILL BRANCH AFTER CHANGES
IF A PROBLEM STARTS TO LOOK BIG AFTER WORKING ON IT, MOVE IT INTO A BRANCH
YOU CAN STILL BRANCH AFTER CHANGES
IF A PROBLEM STARTS TO LOOK BIG AFTER WORKING ON IT, MOVE IT INTO A BRANCH
GIT STASH CAN HOLDS SOME CHANGES FOR LATER
I USE THIS WHEN I GET INTERRUPTED AND NEED TO SWITCH GEARS
GIT STASH CAN HOLDS SOME CHANGES FOR LATER
I USE THIS WHEN I GET INTERRUPTED AND NEED TO SWITCH GEARS
GIT STASH CAN HOLDS SOME CHANGES FOR LATER
I USE THIS WHEN I GET INTERRUPTED AND NEED TO SWITCH GEARS
Editing History
DANA REVISED HER OWN HISTORY
DANA REVISED HER OWN HISTORY
DANA REVISED HER OWN HISTORY
DANA REVISED HER OWN HISTORY
SHE THREW OUT ABOUT 60 COMMITS… ERR, POUNDS
Git Trusts you With
the Scary Power Tools
Git Trusts you With
the Scary Power Tools
Several Git commands can be used to revise the
commit history
Git Trusts you With
the Scary Power Tools
Several Git commands can be used to revise the
commit history

Total rewrites ar...
Git Trusts you With
the Scary Power Tools
Several Git commands can be used to revise the
commit history

Total rewrites ar...
Git Trusts you With
the Scary Power Tools
Several Git commands can be used to revise the
commit history

Total rewrites ar...
YOU CAN AMEND (OR ADD TO) A COMMIT
THIS IS AWESOME PERFECT FOR WHEN YOU FORGET TO ADD A FILE
YOU CAN AMEND (OR ADD TO) A COMMIT
THIS IS AWESOME PERFECT FOR WHEN YOU FORGET TO ADD A FILE
YOU GET A CHANCE TO REVISE THE MESSAGE
AS YOU CAN SEE, I HAVE TEXTMATE SET AS MY EDITOR
THE TWO COMMITS BECAME ONE
NOTICE HOW ALL ASPECTS OF THE SECOND COMMIT WERE ROLLED INTO THE FIRST
THE TWO COMMITS BECAME ONE
NOTICE HOW ALL ASPECTS OF THE SECOND COMMIT WERE ROLLED INTO THE FIRST
GIT CAN “CHERRY PICK” COMMITS
YOU AREN’T REQUIRED TO TAKE COMMITS IN ORDER
GIT CAN “CHERRY PICK” COMMITS
YOU AREN’T REQUIRED TO TAKE COMMITS IN ORDER
GIT CAN “CHERRY PICK” COMMITS
YOU AREN’T REQUIRED TO TAKE COMMITS IN ORDER
Git Speaks Subversion
WHEELCHAIRS CAN RIDE JAPAN’S TRAINS
WHEELCHAIRS CAN RIDE JAPAN’S TRAINS
WHEELCHAIRS CAN RIDE JAPAN’S TRAINS
BE SURE YOU SPEAK A LITTLE JAPANESE THOUGH, JUST IN CASE!
Git Ships With
Subversion Support
Git Ships With
Subversion Support
Checkout with: git svn clone SUBVERSION_URL
Git Ships With
Subversion Support
Checkout with: git svn clone SUBVERSION_URL

 Add --username=USER if needed
Git Ships With
Subversion Support
Checkout with: git svn clone SUBVERSION_URL

  Add --username=USER if needed

Update wit...
Git Ships With
Subversion Support
Checkout with: git svn clone SUBVERSION_URL

  Add --username=USER if needed

Update wit...
Git Ships With
Subversion Support
Checkout with: git svn clone SUBVERSION_URL

  Add --username=USER if needed

Update wit...
Git Ships With
Subversion Support
Checkout with: git svn clone SUBVERSION_URL

  Add --username=USER if needed

Update wit...
Distributed Repositories
YOU CAN NEVER HAVE TOO FEW GEEKS
YOU CAN NEVER HAVE TOO FEW GEEKS
YOU CAN NEVER HAVE TOO FEW GEEKS
I NEED THIS MANY JUST TO PLAY A GAME ONCE A YEAR
git clone 
git://192.168.0.109/faster_csv
To Set That Up…
To Set That Up…
I created a git_server directory on my Desktop
To Set That Up…
I created a git_server directory on my Desktop

  I moved my faster_csv repository into it
To Set That Up…
I created a git_server directory on my Desktop

  I moved my faster_csv repository into it

I ran: git dae...
To Set That Up…
I created a git_server directory on my Desktop

  I moved my faster_csv repository into it

I ran: git dae...
To Set That Up…
I created a git_server directory on my Desktop

  I moved my faster_csv repository into it

I ran: git dae...
http://192.168.0.109:1234/
An Instant
Web Interface
An Instant
Web Interface
I moved into the Git working directory
An Instant
Web Interface
I moved into the Git working directory

I ran: git instaweb --httpd=webrick
An Instant
Web Interface
I moved into the Git working directory

I ran: git instaweb --httpd=webrick

  Later, I will stop...
An Instant
Web Interface
I moved into the Git working directory

I ran: git instaweb --httpd=webrick

  Later, I will stop...
Git Strategies
EVERYBODY HAS THEIR SYSTEM
EVERYBODY HAS THEIR SYSTEM
EVERYBODY HAS THEIR SYSTEM
EVERYBODY HAS THEIR SYSTEM
EVERYBODY HAS THEIR SYSTEM
EVERYBODY HAS THEIR SYSTEM
DANA HAS ONE JUST FOR FOOD
Git Supports
Many Work Styles
Git Supports
Many Work Styles
Git’s features make it very flexible
Git Supports
Many Work Styles
Git’s features make it very flexible

  Non-linear history is fully supported
Git Supports
Many Work Styles
Git’s features make it very flexible

  Non-linear history is fully supported

  Powerful his...
Git Supports
Many Work Styles
Git’s features make it very flexible

  Non-linear history is fully supported

  Powerful his...
Git Supports
Many Work Styles
Git’s features make it very flexible

  Non-linear history is fully supported

  Powerful his...
Git Supports
Many Work Styles
Git’s features make it very flexible

  Non-linear history is fully supported

  Powerful his...
Branch Strategies
SAY WE HAVE A BRANCH WITH TWO COMMITS
THIS IS A PRETTY TYPICAL GIT SCENARIO, A TOPIC BRANCH OFF OF MASTER
FAST FORWARD (A FLAT MERGE)
BY DEFAULT, GIT WOULD JUST ADD THESE COMMITS ONTO MASTER
YOU CAN FORCE GIT TO KEEP THE BRANCH
HTTP://NVIE.COM/GIT-MODEL
YOU CAN FORCE GIT TO KEEP THE BRANCH
HTTP://NVIE.COM/GIT-MODEL
NOTICE HOW GIT ADDED A MERGE COMMIT
YOU CAN REVERT THAT ONE COMMIT TO UNDO THE ENTIRE BRANCH
NOTICE HOW GIT ADDED A MERGE COMMIT
YOU CAN REVERT THAT ONE COMMIT TO UNDO THE ENTIRE BRANCH
ALTERNATELY, YOU COULD SQUASH THE COMMITS
HTTP://GEEWAX.ORG/2009/11/21/AGILE-GIT-WORKFLOW.HTML
ALTERNATELY, YOU COULD SQUASH THE COMMITS
HTTP://GEEWAX.ORG/2009/11/21/AGILE-GIT-WORKFLOW.HTML
REBASE ASKS ME HOW TO HANDLE EACH COMMIT
GIT COMMANDS LIKE ADD AND REBASE SUPPORT A POWERFUL INTERACTIVE MODE
REBASE ASKS ME HOW TO HANDLE EACH COMMIT
GIT COMMANDS LIKE ADD AND REBASE SUPPORT A POWERFUL INTERACTIVE MODE
YOU EVEN GET TO REVISE THE COMMITS
COMBINE OR REPLACE THEM TO TASTE
YOU EVEN GET TO REVISE THE COMMITS
COMBINE OR REPLACE THEM TO TASTE
FINALLY, MERGE THE COLLAPSED COMMIT
I CAN USE THE POWER OF INTERACTIVE MODE TO COLLAPSE THINGS INTO ONE COMMIT
FINALLY, MERGE THE COLLAPSED COMMIT
I CAN USE THE POWER OF INTERACTIVE MODE TO COLLAPSE THINGS INTO ONE COMMIT
A TOPIC BRANCH WAS REDUCED TO ONE COMMIT
THIS IS ANOTHER TECHNIQUE THAT ALLOWS US TO UNDO IT WITH ONE REVERT
A TOPIC BRANCH WAS REDUCED TO ONE COMMIT
THIS IS ANOTHER TECHNIQUE THAT ALLOWS US TO UNDO IT WITH ONE REVERT
Master Repository
Strategies
YOUR SUBVERSION STRATEGY STILL WORKS FINE
THIS IS HOW GITHUB IS COMMONLY USED
LINUS USES HIS “CIRCLE OF TRUST”
HTTP://WWW.YOUTUBE.COM/WATCH?V=4XPNKHJAOK8
LINUS USES HIS “CIRCLE OF TRUST”
HTTP://WWW.YOUTUBE.COM/WATCH?V=4XPNKHJAOK8
LINUS USES HIS “CIRCLE OF TRUST”
HTTP://WWW.YOUTUBE.COM/WATCH?V=4XPNKHJAOK8
GitHub
https://github.com/
Social coding with Git
GitHub is one of
Git’s Killer Features
THIS IS CALLED “FORKING”
THIS IS CALLED “FORKING”
DANA IS SPINNING OFF OF A COPY OF GENES WE WILL EDIT SEPARATELY
“Hardcore Forking Action”
CREATING A GITHUB REPOSITORY IS TRIVIAL
PUBLIC, OPEN SOURCE REPOSITORIES ARE FREE!
CREATING A GITHUB REPOSITORY IS TRIVIAL
PUBLIC, OPEN SOURCE REPOSITORIES ARE FREE!
A REPOSITORY ON GITHUB: THE RAILS SOURCE
HERE YOU CAN BROWSE OR FORK THE CODE
A REPOSITORY ON GITHUB: THE RAILS SOURCE
HERE YOU CAN BROWSE OR FORK THE CODE
A REPOSITORY ON GITHUB: THE RAILS SOURCE
HERE YOU CAN BROWSE OR FORK THE CODE
A REPOSITORY ON GITHUB: THE RAILS SOURCE
HERE YOU CAN BROWSE OR FORK THE CODE
A REPOSITORY ON GITHUB: THE RAILS SOURCE
HERE YOU CAN BROWSE OR FORK THE CODE
A FORKED REPOSITORY: RIOT
THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
A FORKED REPOSITORY: RIOT
THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
A FORKED REPOSITORY: RIOT
THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
A FORKED REPOSITORY: RIOT
THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
A FORKED REPOSITORY: RIOT
THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
THE NETWORK GRAPH
THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
THE NETWORK GRAPH
THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
THE NETWORK GRAPH
THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
THE NETWORK GRAPH
THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
THE FORK QUEUE CAN MERGE EXTERNAL CHANGES
I PREFER TO HANDLE THIS REMOTES SO A CAN WORK WITH NORMAL BRANCHES
THE FORK QUEUE CAN MERGE EXTERNAL CHANGES
I PREFER TO HANDLE THIS REMOTES SO A CAN WORK WITH NORMAL BRANCHES
THE FORK QUEUE CAN MERGE EXTERNAL CHANGES
I PREFER TO HANDLE THIS REMOTES SO A CAN WORK WITH NORMAL BRANCHES
MY FORK AND THE OFFICIAL
GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
MY FORK AND THE OFFICIAL
GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
MY FORK AND THE OFFICIAL
GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
MY FORK AND THE OFFICIAL
GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
FETCHING A REMOTE
GIT FETCH ALLOWS YOU TO ADD ALL DETAILS OF A REMOTE TO YOUR LOCAL COPY
FETCHING A REMOTE
GIT FETCH ALLOWS YOU TO ADD ALL DETAILS OF A REMOTE TO YOUR LOCAL COPY
PLAY WITH CODE FROM A REMOTE
LOCAL BRANCHES CAN TRACK REMOTE BRANCHES
PLAY WITH CODE FROM A REMOTE
LOCAL BRANCHES CAN TRACK REMOTE BRANCHES
PLAY WITH CODE FROM A REMOTE
LOCAL BRANCHES CAN TRACK REMOTE BRANCHES
FULLY SHARE WITH COLLABORATORS
A COLLABORATOR CAN USE THE CODE LIKE YOU WITHOUT PULL REQUESTS
FULLY SHARE WITH COLLABORATORS
A COLLABORATOR CAN USE THE CODE LIKE YOU WITHOUT PULL REQUESTS
FULLY SHARE WITH COLLABORATORS
A COLLABORATOR CAN USE THE CODE LIKE YOU WITHOUT PULL REQUESTS
Gists
OUR NEIGHBOR’S YARD
OUR NEIGHBOR’S YARD
SOME THINGS ARE TOO GOOD NOT TO SHARE
A GIT-CENTRIC CODE PASTING SERVICE
PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
A GIT-CENTRIC CODE PASTING SERVICE
PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
A GIT-CENTRIC CODE PASTING SERVICE
PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
A GIT-CENTRIC CODE PASTING SERVICE
PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
IT’S A PASTE AND A GIT REPOSITORY
YOU CAN FORK THIS CODE OR CLONE IT TO WORK WITH LOCALLY
IT’S A PASTE AND A GIT REPOSITORY
YOU CAN FORK THIS CODE OR CLONE IT TO WORK WITH LOCALLY
Hooks
IT’S ALWAYS GOOD TO HAVE TRAINED HELP
IT’S ALWAYS GOOD TO HAVE TRAINED HELP
IT’S ALWAYS GOOD TO HAVE TRAINED HELP
YOU CAN TEACH GIT AND GITHUB NEW TRICKS
GIT HOOKS
THE POST-COMMIT HOOK CAN BE USED TO AUTO TAG RELEASES
GIT HOOKS
THE POST-COMMIT HOOK CAN BE USED TO AUTO TAG RELEASES
GIT HOOKS
THE POST-COMMIT HOOK CAN BE USED TO AUTO TAG RELEASES
GITHUB SUPPORTS HOOKS
POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
GITHUB SUPPORTS HOOKS
POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
GITHUB SUPPORTS HOOKS
POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
GITHUB SUPPORTS HOOKS
POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
README Formatting
FIRST IMPRESSIONS MATTER
FIRST IMPRESSIONS MATTER
FIRST IMPRESSIONS MATTER
FIRST IMPRESSIONS MATTER
YOU HAVE TO ADVERTISE WHAT’S INSIDE
GITHUB IS SMART ABOUT README FORMATS
IT WILL SHOW README FILES IN EACH FOLDER AND HTMLIFY SOME CONTENT TYPES
GITHUB IS SMART ABOUT README FORMATS
IT WILL SHOW README FILES IN EACH FOLDER AND HTMLIFY SOME CONTENT TYPES
GITHUB IS SMART ABOUT README FORMATS
IT WILL SHOW README FILES IN EACH FOLDER AND HTMLIFY SOME CONTENT TYPES
Supported Formats
Supported Formats
RDoc (.rdoc)
Supported Formats
RDoc (.rdoc)

  Reuse your Ruby project documentation
Supported Formats
RDoc (.rdoc)

  Reuse your Ruby project documentation

Markdown (.markdown, .md, .mdown, …)
Supported Formats
RDoc (.rdoc)

  Reuse your Ruby project documentation

Markdown (.markdown, .md, .mdown, …)

  A human-r...
Supported Formats
RDoc (.rdoc)

  Reuse your Ruby project documentation

Markdown (.markdown, .md, .mdown, …)

  A human-r...
GitHub Pages
OUR NEW OK.RB WEBSITE: HTTP://OK-RUBY.ORG/
OUR NEW OK.RB WEBSITE: HTTP://OK-RUBY.ORG/
OUR NEW OK.RB WEBSITE: HTTP://OK-RUBY.ORG/
YOU CAN HELP MAKE THIS BETTER
IT’S A PROJECT ON GITHUB
THE GITHUB PAGES FEATURE TURNS THIS INTO A REAL SITE
IT’S A PROJECT ON GITHUB
THE GITHUB PAGES FEATURE TURNS THIS INTO A REAL SITE
GitHub Pages
GitHub Pages
Name a repository after you: USER.github.com
GitHub Pages
Name a repository after you: USER.github.com

  Or add a gh-pages branch to any repository
GitHub Pages
Name a repository after you: USER.github.com

  Or add a gh-pages branch to any repository

GitHub will build...
GitHub Pages
Name a repository after you: USER.github.com

  Or add a gh-pages branch to any repository

GitHub will build...
GitHub Pages
Name a repository after you: USER.github.com

  Or add a gh-pages branch to any repository

GitHub will build...
GitHub Pages
Name a repository after you: USER.github.com

  Or add a gh-pages branch to any repository

GitHub will build...
Documentation
Learning more about Git and GitHub
IF YOU FELL ASLEEP IN THIS TALK…
IF YOU FELL ASLEEP IN THIS TALK…
YOU MAY NEED TO RTFM
Where to Find the Docs
Where to Find the Docs
Git has awesome man(ual) pages
Where to Find the Docs
Git has awesome man(ual) pages

 Replace spaces with dashes: man git-stash
Where to Find the Docs
Git has awesome man(ual) pages

  Replace spaces with dashes: man git-stash

Scott Chacon’s (GitHub...
Where to Find the Docs
Git has awesome man(ual) pages

  Replace spaces with dashes: man git-stash

Scott Chacon’s (GitHub...
Where to Find the Docs
Git has awesome man(ual) pages

  Replace spaces with dashes: man git-stash

Scott Chacon’s (GitHub...
Where to Find the Docs
Git has awesome man(ual) pages

  Replace spaces with dashes: man git-stash

Scott Chacon’s (GitHub...
You have passed
this endurance test!
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Git and GitHub
Upcoming SlideShare
Loading in...5
×

Git and GitHub

7,898

Published on

This is a lengthy talk I gave to OK.rb in April covering many aspects of Git and GitHub.

Published in: Technology
1 Comment
34 Likes
Statistics
Notes
No Downloads
Views
Total Views
7,898
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
460
Comments
1
Likes
34
Embeds 0
No embeds

No notes for slide

































































































































































































































































































  • Git and GitHub

    1. 1. Git and GitHub The unabridged story
    2. 2. BUT FIRST A WORD FROM OUR SPONSOR
    3. 3. BUT FIRST A WORD FROM OUR SPONSOR
    4. 4. BUT FIRST A WORD FROM OUR SPONSOR HAPPY BIRTHDAY DANA!
    5. 5. Git The stupid content tracker
    6. 6. What is Git, really?
    7. 7. Intelligence Check
    8. 8. Intelligence Check Subversion is a smart database of file differences
    9. 9. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex
    10. 10. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex Git is pretty stupid
    11. 11. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex Git is pretty stupid Stores trees of content, much like a file system
    12. 12. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex Git is pretty stupid Stores trees of content, much like a file system A commit creates a new tree reachable by name
    13. 13. Intelligence Check Subversion is a smart database of file differences Unfortunately, this makes it quite complex Git is pretty stupid Stores trees of content, much like a file system A commit creates a new tree reachable by name It can change your directory to recreate any tree
    14. 14. Git Isn’t Really an SCM
    15. 15. Git Isn’t Really an SCM Git does Source Code Management and
    16. 16. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution
    17. 17. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution Document database
    18. 18. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution Document database Distributed wiki
    19. 19. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution Document database Distributed wiki Distributed issue tracker
    20. 20. Git Isn’t Really an SCM Git does Source Code Management and Peer to peer content distribution Document database Distributed wiki Distributed issue tracker Backups
    21. 21. The Plusses of a Simple Design
    22. 22. The Plusses of a Simple Design It was designed to manage the development of the Linux kernel (a very large code base)
    23. 23. The Plusses of a Simple Design It was designed to manage the development of the Linux kernel (a very large code base) Git is very efficient
    24. 24. The Plusses of a Simple Design It was designed to manage the development of the Linux kernel (a very large code base) Git is very efficient Git handles non-linear development with grace
    25. 25. The Plusses of a Simple Design It was designed to manage the development of the Linux kernel (a very large code base) Git is very efficient Git handles non-linear development with grace Git is distributed from the ground up
    26. 26. SOMETIMES YOU HAVE A TOILET IN YOUR YARD
    27. 27. SOMETIMES YOU HAVE A TOILET IN YOUR YARD AND WHO WANTS THAT, REALLY?
    28. 28. The Minuses of the Toolkit Design
    29. 29. The Minuses of the Toolkit Design Git provides a ton of commands to interact with it
    30. 30. The Minuses of the Toolkit Design Git provides a ton of commands to interact with it The “porcelain” commands are the ones you typically interact with
    31. 31. The Minuses of the Toolkit Design Git provides a ton of commands to interact with it The “porcelain” commands are the ones you typically interact with The lower-level “plumbing” commands are crazy powerful, but less user friendly
    32. 32. The Minuses of the Toolkit Design Git provides a ton of commands to interact with it The “porcelain” commands are the ones you typically interact with The lower-level “plumbing” commands are crazy powerful, but less user friendly This can add up to make Git a little intimidating
    33. 33. Installing and Configuring
    34. 34. IF YOU BUILD IT, THEY WILL COME
    35. 35. IF YOU BUILD IT, THEY WILL COME
    36. 36. IF YOU BUILD IT, THEY WILL COME SOMETIMES YOU JUST HAVE TO INSTALL A RIDICULOUS ROBOT
    37. 37. OFFICIAL SITE: HTTP://GIT-SCM.COM/ THERE ARE BINARIES FOR SOME PLATFORMS
    38. 38. OFFICIAL SITE: HTTP://GIT-SCM.COM/ THERE ARE BINARIES FOR SOME PLATFORMS
    39. 39. OFFICIAL SITE: HTTP://GIT-SCM.COM/ THERE ARE BINARIES FOR SOME PLATFORMS
    40. 40. THE INSTRUCTIONS I USE TO BUILD ON MAC OS X THESE SIDESTEP THE DOCUMENTATION AND MACPORTS REQUIREMENTS
    41. 41. THE INSTRUCTIONS I USE TO BUILD ON MAC OS X THESE SIDESTEP THE DOCUMENTATION AND MACPORTS REQUIREMENTS
    42. 42. Git is still young and growing fast (update to 1.7)
    43. 43. [user] name = James Edward Gray II email = james@graysoftinc.com [apply] whitespace = nowarn [color] status = auto branch = auto interactive = auto repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [gc] auto = 1 [github] user = JEG2 token = … ~/.GITCONFIG THESE ARE SOME VERY HELPFUL GIT INTERFACE SETTINGS
    44. 44. [user] name = James Edward Gray II email = james@graysoftinc.com [apply] whitespace = nowarn [color] status = auto branch = auto interactive = auto repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [gc] auto = 1 [github] user = JEG2 token = … ~/.GITCONFIG THESE ARE SOME VERY HELPFUL GIT INTERFACE SETTINGS
    45. 45. [user] name = James Edward Gray II email = james@graysoftinc.com [apply] whitespace = nowarn [color] status = auto branch = auto interactive = auto repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [gc] auto = 1 [github] user = JEG2 token = … ~/.GITCONFIG THESE ARE SOME VERY HELPFUL GIT INTERFACE SETTINGS
    46. 46. [user] name = James Edward Gray II email = james@graysoftinc.com [apply] whitespace = nowarn [color] status = auto branch = auto interactive = auto repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [gc] auto = 1 [github] user = JEG2 token = … ~/.GITCONFIG THESE ARE SOME VERY HELPFUL GIT INTERFACE SETTINGS
    47. 47. set mainfont {Monaco 12} set textfont {Monaco 12} set uifont {"Monaco Bold" 12} set tabstop 8 set findmergefiles 0 set maxgraphpct 50 set maxwidth 16 set cmitmode patch set wrapcomment none set showneartags 1 set showlocalchanges 1 set datetimeformat {%Y-%m-%d %H:%M:%S} set limitdiffs 1 set bgcolor white set fgcolor black set colors {green red blue magenta darkgrey brown orange} set diffcolors {red "#00a000" blue} set diffcontext 3 set selectbgcolor gray85 set geometry(main) 794x484+5+45 set geometry(topwidth) 790 set geometry(topheight) 150 set geometry(pwsash0) "280 2" set geometry(pwsash1) "420 2" set geometry(botwidth) 350 set geometry(botheight) 314 set permviews {} ~/.GITK THESE SETTINGS CLEAN UP THE INCLUDED GUI
    48. 48. # Git alias g="git status" alias ga="git add" alias gaa="git add ." alias gc="git commit -m" alias gca="git commit -am" alias gb="git branch" alias gbd="git branch -d" alias gco="git checkout" alias gcob="git checkout -b" alias gm="git merge" alias gr="git rebase" alias gl="git log" alias gs="git show" alias gd="git diff" alias gbl="git blame" alias gps="git push" alias gpl="git pull" ~/.BASHRC THESE ARE SOME BASH ALIASES I USE
    49. 49. # Git alias g="git status" alias ga="git add" alias gaa="git add ." alias gc="git commit -m" alias gca="git commit -am" alias gb="git branch" alias gbd="git branch -d" alias gco="git checkout" alias gcob="git checkout -b" alias gm="git merge" alias gr="git rebase" alias gl="git log" alias gs="git show" alias gd="git diff" alias gbl="git blame" alias gps="git push" alias gpl="git pull" ~/.BASHRC THESE ARE SOME BASH ALIASES I USE
    50. 50. # Git alias g="git status" alias ga="git add" alias gaa="git add ." alias gc="git commit -m" alias gca="git commit -am" alias gb="git branch" alias gbd="git branch -d" alias gco="git checkout" alias gcob="git checkout -b" alias gm="git merge" alias gr="git rebase" alias gl="git log" alias gs="git show" alias gd="git diff" alias gbl="git blame" alias gps="git push" alias gpl="git pull" ~/.BASHRC THESE ARE SOME BASH ALIASES I USE
    51. 51. Memorize all of That?
    52. 52. Memorize all of That? There’s a new trend to store your “dotfiles” online
    53. 53. Memorize all of That? There’s a new trend to store your “dotfiles” online This makes it easy to move them
    54. 54. Memorize all of That? There’s a new trend to store your “dotfiles” online This makes it easy to move them Plus we can all share
    55. 55. Memorize all of That? There’s a new trend to store your “dotfiles” online This makes it easy to move them Plus we can all share Surprise: A great place to find these is GitHub
    56. 56. Memorize all of That? There’s a new trend to store your “dotfiles” online This makes it easy to move them Plus we can all share Surprise: A great place to find these is GitHub Mine are at: http://github.com/JEG2/dotfiles
    57. 57. Staging and Commits
    58. 58. DANA IS SAD
    59. 59. DANA IS SAD
    60. 60. DANA IS SAD HER CRAFT ROOM IS TRANSITIONING INTO A NURSERY
    61. 61. STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
    62. 62. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
    63. 63. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
    64. 64. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
    65. 65. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
    66. 66. GIT STATUS GIT ADD . GIT STATUS GIT COMMIT -M “FIRST COMMIT.” STAGING A CHANGE, THEN COMMITTING THIS IS A NORMAL WORKFLOW FOR CHANGES IN GIT
    67. 67. GIT DATA IS SHARED BY THREE AREAS THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
    68. 68. THE WORKING DIRECTORY GIT DATA IS SHARED BY THREE AREAS THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
    69. 69. THE INDEX OR STAGING AREA GIT DATA IS SHARED BY THREE AREAS THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
    70. 70. THE REPOSITORY GIT DATA IS SHARED BY THREE AREAS THE REPOSITORY HOLDS ALL POSSIBLE WORKING DIRECTORIES
    71. 71. GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
    72. 72. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
    73. 73. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
    74. 74. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
    75. 75. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
    76. 76. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
    77. 77. GIT LOG GIT SHOW 96987 GIT SHOW 5F3F6 GIT BLAME README GIT INCLUDES POWERFUL INSPECTION TOOLS A SHA1 HASH (40 CHARACTERS) IS HOW GIT NAMES EVERYTHING
    78. 78. Branching and Merging
    79. 79. YOU CAN ADD BRANCHES TO ANYTHING
    80. 80. YOU CAN ADD BRANCHES TO ANYTHING
    81. 81. YOU CAN ADD BRANCHES TO ANYTHING A KID, YOUR SOURCE CODE, OR WHATEVER
    82. 82. Using Git without branches is like buying condoms and not having any sex
    83. 83. GIT WAS MADE TO BRANCH, LITERALLY! WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
    84. 84. GIT WAS MADE TO BRANCH, LITERALLY! WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
    85. 85. GIT WAS MADE TO BRANCH, LITERALLY! WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
    86. 86. GIT WAS MADE TO BRANCH, LITERALLY! WHEN YOU BRANCH, GIT HAS TO WRITE 40 CHARACTERS TO A FILE (SUPER CHEAP)!
    87. 87. THE INCLUDED GITK SHOWS BRANCHES PASS THE --ALL FLAG TO SEE BRANCHES YOU AREN’T CURRENTLY ON
    88. 88. THE INCLUDED GITK SHOWS BRANCHES PASS THE --ALL FLAG TO SEE BRANCHES YOU AREN’T CURRENTLY ON
    89. 89. GIT MERGE PULLS THE NAMED BRANCH IN UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
    90. 90. GIT MERGE PULLS THE NAMED BRANCH IN UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
    91. 91. GIT MERGE PULLS THE NAMED BRANCH IN UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
    92. 92. GIT MERGE PULLS THE NAMED BRANCH IN UNLIKE SUBVERSION, GIT MERGE IS POWERFUL, SMART, AND EASY TO USE
    93. 93. THE HISTORY SHOWS THE INCORPORATED BRANCH EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
    94. 94. THE HISTORY SHOWS THE INCORPORATED BRANCH EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
    95. 95. THE HISTORY SHOWS THE INCORPORATED BRANCH EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
    96. 96. THE HISTORY SHOWS THE INCORPORATED BRANCH EVEN AFTER THE BRANCH IS DELETED, GIT REMEMBERS WHERE IT CAME FROM
    97. 97. REBASE CAN BE USED TO FLATTEN THE HISTORY YOU CAN CHOOSE TO ADD A BRANCH ONTO THE END OF ANOTHER BRANCH
    98. 98. REBASE CAN BE USED TO FLATTEN THE HISTORY YOU CAN CHOOSE TO ADD A BRANCH ONTO THE END OF ANOTHER BRANCH
    99. 99. REBASE CAN BE USED TO FLATTEN THE HISTORY YOU CAN CHOOSE TO ADD A BRANCH ONTO THE END OF ANOTHER BRANCH
    100. 100. NOW THE MERGED HISTORY IS JUST A FLAT LINE GIT REPLAYED OUR CHANGES ONTO THE END OF THE MASTER BRANCH
    101. 101. With Git, it’s never too late to branch!
    102. 102. YOU CAN STILL BRANCH AFTER CHANGES IF A PROBLEM STARTS TO LOOK BIG AFTER WORKING ON IT, MOVE IT INTO A BRANCH
    103. 103. YOU CAN STILL BRANCH AFTER CHANGES IF A PROBLEM STARTS TO LOOK BIG AFTER WORKING ON IT, MOVE IT INTO A BRANCH
    104. 104. GIT STASH CAN HOLDS SOME CHANGES FOR LATER I USE THIS WHEN I GET INTERRUPTED AND NEED TO SWITCH GEARS
    105. 105. GIT STASH CAN HOLDS SOME CHANGES FOR LATER I USE THIS WHEN I GET INTERRUPTED AND NEED TO SWITCH GEARS
    106. 106. GIT STASH CAN HOLDS SOME CHANGES FOR LATER I USE THIS WHEN I GET INTERRUPTED AND NEED TO SWITCH GEARS
    107. 107. Editing History
    108. 108. DANA REVISED HER OWN HISTORY
    109. 109. DANA REVISED HER OWN HISTORY
    110. 110. DANA REVISED HER OWN HISTORY
    111. 111. DANA REVISED HER OWN HISTORY SHE THREW OUT ABOUT 60 COMMITS… ERR, POUNDS
    112. 112. Git Trusts you With the Scary Power Tools
    113. 113. Git Trusts you With the Scary Power Tools Several Git commands can be used to revise the commit history
    114. 114. Git Trusts you With the Scary Power Tools Several Git commands can be used to revise the commit history Total rewrites are possible
    115. 115. Git Trusts you With the Scary Power Tools Several Git commands can be used to revise the commit history Total rewrites are possible Some consider this very evil
    116. 116. Git Trusts you With the Scary Power Tools Several Git commands can be used to revise the commit history Total rewrites are possible Some consider this very evil Let me show you two lighter uses that I consider practical
    117. 117. YOU CAN AMEND (OR ADD TO) A COMMIT THIS IS AWESOME PERFECT FOR WHEN YOU FORGET TO ADD A FILE
    118. 118. YOU CAN AMEND (OR ADD TO) A COMMIT THIS IS AWESOME PERFECT FOR WHEN YOU FORGET TO ADD A FILE
    119. 119. YOU GET A CHANCE TO REVISE THE MESSAGE AS YOU CAN SEE, I HAVE TEXTMATE SET AS MY EDITOR
    120. 120. THE TWO COMMITS BECAME ONE NOTICE HOW ALL ASPECTS OF THE SECOND COMMIT WERE ROLLED INTO THE FIRST
    121. 121. THE TWO COMMITS BECAME ONE NOTICE HOW ALL ASPECTS OF THE SECOND COMMIT WERE ROLLED INTO THE FIRST
    122. 122. GIT CAN “CHERRY PICK” COMMITS YOU AREN’T REQUIRED TO TAKE COMMITS IN ORDER
    123. 123. GIT CAN “CHERRY PICK” COMMITS YOU AREN’T REQUIRED TO TAKE COMMITS IN ORDER
    124. 124. GIT CAN “CHERRY PICK” COMMITS YOU AREN’T REQUIRED TO TAKE COMMITS IN ORDER
    125. 125. Git Speaks Subversion
    126. 126. WHEELCHAIRS CAN RIDE JAPAN’S TRAINS
    127. 127. WHEELCHAIRS CAN RIDE JAPAN’S TRAINS
    128. 128. WHEELCHAIRS CAN RIDE JAPAN’S TRAINS BE SURE YOU SPEAK A LITTLE JAPANESE THOUGH, JUST IN CASE!
    129. 129. Git Ships With Subversion Support
    130. 130. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL
    131. 131. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed
    132. 132. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed Update with: git svn rebase
    133. 133. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed Update with: git svn rebase Subversion requires a linear history, thus rebase
    134. 134. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed Update with: git svn rebase Subversion requires a linear history, thus rebase Use Git to develop locally as normal
    135. 135. Git Ships With Subversion Support Checkout with: git svn clone SUBVERSION_URL Add --username=USER if needed Update with: git svn rebase Subversion requires a linear history, thus rebase Use Git to develop locally as normal Commit all diffs to Subversion: git svn dcommit
    136. 136. Distributed Repositories
    137. 137. YOU CAN NEVER HAVE TOO FEW GEEKS
    138. 138. YOU CAN NEVER HAVE TOO FEW GEEKS
    139. 139. YOU CAN NEVER HAVE TOO FEW GEEKS I NEED THIS MANY JUST TO PLAY A GAME ONCE A YEAR
    140. 140. git clone git://192.168.0.109/faster_csv
    141. 141. To Set That Up…
    142. 142. To Set That Up… I created a git_server directory on my Desktop
    143. 143. To Set That Up… I created a git_server directory on my Desktop I moved my faster_csv repository into it
    144. 144. To Set That Up… I created a git_server directory on my Desktop I moved my faster_csv repository into it I ran: git daemon --base-path=/Users/james/ Desktop/git_server --export-all
    145. 145. To Set That Up… I created a git_server directory on my Desktop I moved my faster_csv repository into it I ran: git daemon --base-path=/Users/james/ Desktop/git_server --export-all This is read-only (but write support is possible) access on port 9418
    146. 146. To Set That Up… I created a git_server directory on my Desktop I moved my faster_csv repository into it I ran: git daemon --base-path=/Users/james/ Desktop/git_server --export-all This is read-only (but write support is possible) access on port 9418 This rocks for when GitHub is down
    147. 147. http://192.168.0.109:1234/
    148. 148. An Instant Web Interface
    149. 149. An Instant Web Interface I moved into the Git working directory
    150. 150. An Instant Web Interface I moved into the Git working directory I ran: git instaweb --httpd=webrick
    151. 151. An Instant Web Interface I moved into the Git working directory I ran: git instaweb --httpd=webrick Later, I will stop it with: git instaweb --stop
    152. 152. An Instant Web Interface I moved into the Git working directory I ran: git instaweb --httpd=webrick Later, I will stop it with: git instaweb --stop This is a handy poor man’s repository browser that’s pretty much always available
    153. 153. Git Strategies
    154. 154. EVERYBODY HAS THEIR SYSTEM
    155. 155. EVERYBODY HAS THEIR SYSTEM
    156. 156. EVERYBODY HAS THEIR SYSTEM
    157. 157. EVERYBODY HAS THEIR SYSTEM
    158. 158. EVERYBODY HAS THEIR SYSTEM
    159. 159. EVERYBODY HAS THEIR SYSTEM DANA HAS ONE JUST FOR FOOD
    160. 160. Git Supports Many Work Styles
    161. 161. Git Supports Many Work Styles Git’s features make it very flexible
    162. 162. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported
    163. 163. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported Powerful history rewriting is provided
    164. 164. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported Powerful history rewriting is provided All repositories are masters
    165. 165. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported Powerful history rewriting is provided All repositories are masters Any repository can be distributed
    166. 166. Git Supports Many Work Styles Git’s features make it very flexible Non-linear history is fully supported Powerful history rewriting is provided All repositories are masters Any repository can be distributed Many work strategies are built off of these features
    167. 167. Branch Strategies
    168. 168. SAY WE HAVE A BRANCH WITH TWO COMMITS THIS IS A PRETTY TYPICAL GIT SCENARIO, A TOPIC BRANCH OFF OF MASTER
    169. 169. FAST FORWARD (A FLAT MERGE) BY DEFAULT, GIT WOULD JUST ADD THESE COMMITS ONTO MASTER
    170. 170. YOU CAN FORCE GIT TO KEEP THE BRANCH HTTP://NVIE.COM/GIT-MODEL
    171. 171. YOU CAN FORCE GIT TO KEEP THE BRANCH HTTP://NVIE.COM/GIT-MODEL
    172. 172. NOTICE HOW GIT ADDED A MERGE COMMIT YOU CAN REVERT THAT ONE COMMIT TO UNDO THE ENTIRE BRANCH
    173. 173. NOTICE HOW GIT ADDED A MERGE COMMIT YOU CAN REVERT THAT ONE COMMIT TO UNDO THE ENTIRE BRANCH
    174. 174. ALTERNATELY, YOU COULD SQUASH THE COMMITS HTTP://GEEWAX.ORG/2009/11/21/AGILE-GIT-WORKFLOW.HTML
    175. 175. ALTERNATELY, YOU COULD SQUASH THE COMMITS HTTP://GEEWAX.ORG/2009/11/21/AGILE-GIT-WORKFLOW.HTML
    176. 176. REBASE ASKS ME HOW TO HANDLE EACH COMMIT GIT COMMANDS LIKE ADD AND REBASE SUPPORT A POWERFUL INTERACTIVE MODE
    177. 177. REBASE ASKS ME HOW TO HANDLE EACH COMMIT GIT COMMANDS LIKE ADD AND REBASE SUPPORT A POWERFUL INTERACTIVE MODE
    178. 178. YOU EVEN GET TO REVISE THE COMMITS COMBINE OR REPLACE THEM TO TASTE
    179. 179. YOU EVEN GET TO REVISE THE COMMITS COMBINE OR REPLACE THEM TO TASTE
    180. 180. FINALLY, MERGE THE COLLAPSED COMMIT I CAN USE THE POWER OF INTERACTIVE MODE TO COLLAPSE THINGS INTO ONE COMMIT
    181. 181. FINALLY, MERGE THE COLLAPSED COMMIT I CAN USE THE POWER OF INTERACTIVE MODE TO COLLAPSE THINGS INTO ONE COMMIT
    182. 182. A TOPIC BRANCH WAS REDUCED TO ONE COMMIT THIS IS ANOTHER TECHNIQUE THAT ALLOWS US TO UNDO IT WITH ONE REVERT
    183. 183. A TOPIC BRANCH WAS REDUCED TO ONE COMMIT THIS IS ANOTHER TECHNIQUE THAT ALLOWS US TO UNDO IT WITH ONE REVERT
    184. 184. Master Repository Strategies
    185. 185. YOUR SUBVERSION STRATEGY STILL WORKS FINE THIS IS HOW GITHUB IS COMMONLY USED
    186. 186. LINUS USES HIS “CIRCLE OF TRUST” HTTP://WWW.YOUTUBE.COM/WATCH?V=4XPNKHJAOK8
    187. 187. LINUS USES HIS “CIRCLE OF TRUST” HTTP://WWW.YOUTUBE.COM/WATCH?V=4XPNKHJAOK8
    188. 188. LINUS USES HIS “CIRCLE OF TRUST” HTTP://WWW.YOUTUBE.COM/WATCH?V=4XPNKHJAOK8
    189. 189. GitHub https://github.com/ Social coding with Git
    190. 190. GitHub is one of Git’s Killer Features
    191. 191. THIS IS CALLED “FORKING”
    192. 192. THIS IS CALLED “FORKING” DANA IS SPINNING OFF OF A COPY OF GENES WE WILL EDIT SEPARATELY
    193. 193. “Hardcore Forking Action”
    194. 194. CREATING A GITHUB REPOSITORY IS TRIVIAL PUBLIC, OPEN SOURCE REPOSITORIES ARE FREE!
    195. 195. CREATING A GITHUB REPOSITORY IS TRIVIAL PUBLIC, OPEN SOURCE REPOSITORIES ARE FREE!
    196. 196. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
    197. 197. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
    198. 198. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
    199. 199. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
    200. 200. A REPOSITORY ON GITHUB: THE RAILS SOURCE HERE YOU CAN BROWSE OR FORK THE CODE
    201. 201. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
    202. 202. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
    203. 203. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
    204. 204. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
    205. 205. A FORKED REPOSITORY: RIOT THIS FORK IS LINKED BACK TO THE ORIGINAL AND THEY CAN PULL FROM IT
    206. 206. THE NETWORK GRAPH THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
    207. 207. THE NETWORK GRAPH THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
    208. 208. THE NETWORK GRAPH THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
    209. 209. THE NETWORK GRAPH THIS IS WHERE YOU CAN SEE HOW ALL OF THE FORKS RELATE
    210. 210. THE FORK QUEUE CAN MERGE EXTERNAL CHANGES I PREFER TO HANDLE THIS REMOTES SO A CAN WORK WITH NORMAL BRANCHES
    211. 211. THE FORK QUEUE CAN MERGE EXTERNAL CHANGES I PREFER TO HANDLE THIS REMOTES SO A CAN WORK WITH NORMAL BRANCHES
    212. 212. THE FORK QUEUE CAN MERGE EXTERNAL CHANGES I PREFER TO HANDLE THIS REMOTES SO A CAN WORK WITH NORMAL BRANCHES
    213. 213. MY FORK AND THE OFFICIAL GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
    214. 214. MY FORK AND THE OFFICIAL GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
    215. 215. MY FORK AND THE OFFICIAL GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
    216. 216. MY FORK AND THE OFFICIAL GIT’S REMOTES CAN MANAGE ANY NUMBER OF RELATED REPOSITORIES
    217. 217. FETCHING A REMOTE GIT FETCH ALLOWS YOU TO ADD ALL DETAILS OF A REMOTE TO YOUR LOCAL COPY
    218. 218. FETCHING A REMOTE GIT FETCH ALLOWS YOU TO ADD ALL DETAILS OF A REMOTE TO YOUR LOCAL COPY
    219. 219. PLAY WITH CODE FROM A REMOTE LOCAL BRANCHES CAN TRACK REMOTE BRANCHES
    220. 220. PLAY WITH CODE FROM A REMOTE LOCAL BRANCHES CAN TRACK REMOTE BRANCHES
    221. 221. PLAY WITH CODE FROM A REMOTE LOCAL BRANCHES CAN TRACK REMOTE BRANCHES
    222. 222. FULLY SHARE WITH COLLABORATORS A COLLABORATOR CAN USE THE CODE LIKE YOU WITHOUT PULL REQUESTS
    223. 223. FULLY SHARE WITH COLLABORATORS A COLLABORATOR CAN USE THE CODE LIKE YOU WITHOUT PULL REQUESTS
    224. 224. FULLY SHARE WITH COLLABORATORS A COLLABORATOR CAN USE THE CODE LIKE YOU WITHOUT PULL REQUESTS
    225. 225. Gists
    226. 226. OUR NEIGHBOR’S YARD
    227. 227. OUR NEIGHBOR’S YARD SOME THINGS ARE TOO GOOD NOT TO SHARE
    228. 228. A GIT-CENTRIC CODE PASTING SERVICE PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
    229. 229. A GIT-CENTRIC CODE PASTING SERVICE PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
    230. 230. A GIT-CENTRIC CODE PASTING SERVICE PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
    231. 231. A GIT-CENTRIC CODE PASTING SERVICE PASTE ONE OR MORE FILES TAGGED WITH A LANGUAGE
    232. 232. IT’S A PASTE AND A GIT REPOSITORY YOU CAN FORK THIS CODE OR CLONE IT TO WORK WITH LOCALLY
    233. 233. IT’S A PASTE AND A GIT REPOSITORY YOU CAN FORK THIS CODE OR CLONE IT TO WORK WITH LOCALLY
    234. 234. Hooks
    235. 235. IT’S ALWAYS GOOD TO HAVE TRAINED HELP
    236. 236. IT’S ALWAYS GOOD TO HAVE TRAINED HELP
    237. 237. IT’S ALWAYS GOOD TO HAVE TRAINED HELP YOU CAN TEACH GIT AND GITHUB NEW TRICKS
    238. 238. GIT HOOKS THE POST-COMMIT HOOK CAN BE USED TO AUTO TAG RELEASES
    239. 239. GIT HOOKS THE POST-COMMIT HOOK CAN BE USED TO AUTO TAG RELEASES
    240. 240. GIT HOOKS THE POST-COMMIT HOOK CAN BE USED TO AUTO TAG RELEASES
    241. 241. GITHUB SUPPORTS HOOKS POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
    242. 242. GITHUB SUPPORTS HOOKS POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
    243. 243. GITHUB SUPPORTS HOOKS POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
    244. 244. GITHUB SUPPORTS HOOKS POST TO A URL, SEND AN EMAIL, OR MORE WHEN GITHUB IS PUSHED TO
    245. 245. README Formatting
    246. 246. FIRST IMPRESSIONS MATTER
    247. 247. FIRST IMPRESSIONS MATTER
    248. 248. FIRST IMPRESSIONS MATTER
    249. 249. FIRST IMPRESSIONS MATTER YOU HAVE TO ADVERTISE WHAT’S INSIDE
    250. 250. GITHUB IS SMART ABOUT README FORMATS IT WILL SHOW README FILES IN EACH FOLDER AND HTMLIFY SOME CONTENT TYPES
    251. 251. GITHUB IS SMART ABOUT README FORMATS IT WILL SHOW README FILES IN EACH FOLDER AND HTMLIFY SOME CONTENT TYPES
    252. 252. GITHUB IS SMART ABOUT README FORMATS IT WILL SHOW README FILES IN EACH FOLDER AND HTMLIFY SOME CONTENT TYPES
    253. 253. Supported Formats
    254. 254. Supported Formats RDoc (.rdoc)
    255. 255. Supported Formats RDoc (.rdoc) Reuse your Ruby project documentation
    256. 256. Supported Formats RDoc (.rdoc) Reuse your Ruby project documentation Markdown (.markdown, .md, .mdown, …)
    257. 257. Supported Formats RDoc (.rdoc) Reuse your Ruby project documentation Markdown (.markdown, .md, .mdown, …) A human-readable format for other projects
    258. 258. Supported Formats RDoc (.rdoc) Reuse your Ruby project documentation Markdown (.markdown, .md, .mdown, …) A human-readable format for other projects Also supported: Textile (.textile), PNG (.png), reStructuredText (.rst), and POD (.pod)
    259. 259. GitHub Pages
    260. 260. OUR NEW OK.RB WEBSITE: HTTP://OK-RUBY.ORG/
    261. 261. OUR NEW OK.RB WEBSITE: HTTP://OK-RUBY.ORG/
    262. 262. OUR NEW OK.RB WEBSITE: HTTP://OK-RUBY.ORG/ YOU CAN HELP MAKE THIS BETTER
    263. 263. IT’S A PROJECT ON GITHUB THE GITHUB PAGES FEATURE TURNS THIS INTO A REAL SITE
    264. 264. IT’S A PROJECT ON GITHUB THE GITHUB PAGES FEATURE TURNS THIS INTO A REAL SITE
    265. 265. GitHub Pages
    266. 266. GitHub Pages Name a repository after you: USER.github.com
    267. 267. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository
    268. 268. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository GitHub will build the site after each commit
    269. 269. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository GitHub will build the site after each commit Sites are Jekyll (a static site generator) processed
    270. 270. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository GitHub will build the site after each commit Sites are Jekyll (a static site generator) processed Used to build listings, syntax highlight, etc.
    271. 271. GitHub Pages Name a repository after you: USER.github.com Or add a gh-pages branch to any repository GitHub will build the site after each commit Sites are Jekyll (a static site generator) processed Used to build listings, syntax highlight, etc. You can point a real domain at them
    272. 272. Documentation Learning more about Git and GitHub
    273. 273. IF YOU FELL ASLEEP IN THIS TALK…
    274. 274. IF YOU FELL ASLEEP IN THIS TALK… YOU MAY NEED TO RTFM
    275. 275. Where to Find the Docs
    276. 276. Where to Find the Docs Git has awesome man(ual) pages
    277. 277. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash
    278. 278. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash Scott Chacon’s (GitHub’s Git Guru) Pro Git book
    279. 279. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash Scott Chacon’s (GitHub’s Git Guru) Pro Git book Free online: http://progit.org/
    280. 280. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash Scott Chacon’s (GitHub’s Git Guru) Pro Git book Free online: http://progit.org/ GitHub has good guides: http://help.github.com/
    281. 281. Where to Find the Docs Git has awesome man(ual) pages Replace spaces with dashes: man git-stash Scott Chacon’s (GitHub’s Git Guru) Pro Git book Free online: http://progit.org/ GitHub has good guides: http://help.github.com/ They cover GitHub and Git topics
    282. 282. You have passed this endurance test!
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×