Your SlideShare is downloading. ×
Gittalk
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Gittalk

568
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
568
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
43
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Git and Github Basics http://git-scm.com
    • 2. Why Git?
    • 3. Why Git?Distributed Repositories
    • 4. Why Git?Distributed RepositoriesEasy Merging
    • 5. Why Git?Distributed RepositoriesEasy MergingNo File Locks
    • 6. Starting From Scratch?
    • 7. Starting From Scratch?new_project patrick$ git initInitialized empty Git repository in /Users/patrick/gittalk/new_project/.git/
    • 8. Existing Repository?
    • 9. Existing Repository?patrick$ git clone git@github.com:thelearninghouse/request-forms.git <location>
    • 10. Committing a changepatrick$ echo "Initial README" > READMEpatrick$ git add READMEpatrick$ git commit -m "Added README"[master (root-commit) 5008efe] Added README 1 file changed, 1 insertion(+) create mode 100644 README
    • 11. What Happened?
    • 12. What Happened?patrick$ git logcommit 5008efe3eab3e746f1d54214566c6b3ed79d3656Author: Patrick Tinsley <prtinsley@gmail.com>Date: Thu Oct 25 21:31:17 2012 -0400 Added README
    • 13. How Git Works Working Directory git add Staging git commit Repository
    • 14. WorkflowCodeStage your changes (git add)Review your work (git status, git diff)Commit (locally) (git commit)Repeat
    • 15. Un-Staged Changes
    • 16. Un-Staged Changespatrick$ echo “I’m updating this again.” > README
    • 17. Un-Staged Changespatrick$ echo “I’m updating this again.” > READMEpatrick$ git status# On branch master# Changes not staged for commit:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes inworking directory)## modified: README#no changes added to commit (use "git add" and/or "git commit -a")
    • 18. Staged Changes
    • 19. Staged Changespatrick$ git add .
    • 20. Staged Changespatrick$ git add .patrick$ git status# On branch master# Changes to be committed:# (use "git reset HEAD <file>..." to unstage)## modified: README#
    • 21. Reset
    • 22. Resetpatrick$ git resetUnstaged changes after reset:M README
    • 23. Resetpatrick$ git resetUnstaged changes after reset:M READMEpatrick$ git status# On branch master# Changes not staged for commit:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in workingdirectory)## modified: README#no changes added to commit (use "git add" and/or "git commit -a")
    • 24. Hard Reset
    • 25. Hard Resetpatrick$ git reset --hard HEADHEAD is now at e502220 Test update
    • 26. Why Branch?
    • 27. Why Branch?Safely experiment with new ideas
    • 28. Why Branch?Safely experiment with new ideasAgility
    • 29. Why Branch?Safely experiment with new ideasAgilityGit makes branching easy
    • 30. Why Branch?Safely experiment with new ideasAgilityGit makes branching easyGit makes merging (usually...) very easy
    • 31. Branch and Mergec5 c4 c3 c2 c1 master c2 c1 new_feature
    • 32. How Do We Do It?
    • 33. How Do We Do It?patrick$ git checkout -b new_featureSwitched to a new branch new_feature
    • 34. How Do We Do It?patrick$ git checkout -b new_featureSwitched to a new branch new_featurepatrick$ git branch master* new_feature
    • 35. How Do We Do It?patrick$ git checkout -b new_featureSwitched to a new branch new_featurepatrick$ git branch master* new_featurepatrick$ git checkout masterSwitched to branch master
    • 36. How Do We Do It?patrick$ git checkout -b new_featureSwitched to a new branch new_featurepatrick$ git branch master* new_featurepatrick$ git checkout masterSwitched to branch masterpatrick$ git branch -d new_featureDeleted branch new_feature (was5008efe).
    • 37. What About Merging?
    • 38. What About Merging?patrick$ git checkout masterSwitched to branch master
    • 39. What About Merging?patrick$ git checkout masterSwitched to branch masterpatrick$ git merge update_readmeUpdating 01ba47f..ee04cb3Fast-forward README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
    • 40. Conflict!
    • 41. Conflict!patrick$ git merge update_readmeAuto-merging READMECONFLICT (content): Merge conflict in READMEAutomatic merge failed; fix conflicts and then commit the result.
    • 42. What Happened?
    • 43. What Happened?patrick$ git status# On branch master# Unmerged paths:# (use "git add/rm <file>..." as appropriate to markresolution)## both modified: README#no changes added to commit (use "git add" and/or "git commit -a")
    • 44. Resolve and Commit
    • 45. Remote RepositoriesGithub.comAnother copy, much like yoursBackupCollaborateDistributeService Hooks
    • 46. Working With Github
    • 47. Working With GithubUpdate your knowledge of Github (git fetch)
    • 48. Working With GithubUpdate your knowledge of Github (git fetch)Update your local copy (git pull)
    • 49. Working With GithubUpdate your knowledge of Github (git fetch)Update your local copy (git pull)Push your code to Github (git push)
    • 50. Example
    • 51. Exampleexample_app patrick$ git pull origin masterFrom github.com:prtinsley/example_app * branch master -> FETCH_HEADAlready up-to-date.
    • 52. Exampleexample_app patrick$ git pull origin masterFrom github.com:prtinsley/example_app * branch master -> FETCH_HEADAlready up-to-date.example_app patrick$ git push origin masterCounting objects: 5, done.Delta compression using up to 8 threads.Compressing objects: 100% (3/3), done.Writing objects: 100% (3/3), 300 bytes, done.Total 3 (delta 2), reused 0 (delta 0)To git@github.com:prtinsley/first_app.git 261f716..8b66dca master -> master
    • 53. Stashing
    • 54. StashingCannot change branches with pendingchangesSave your work if not ready to commitApply pending changes to a different branchWorks like a stack
    • 55. Example
    • 56. Examplepatrick$ git status# On branch master# Changes not staged for commit:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in workingdirectory)## modified: README
    • 57. Examplepatrick$ git status# On branch master# Changes not staged for commit:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in workingdirectory)## modified: READMEpatrick$ git stashSaved working directory and index state WIP on master: 92a5183Updated READMEHEAD is now at 92a5183 Updated README
    • 58. Example
    • 59. Examplepatrick$ git status# On branch masternothing to commit (working directory clean)
    • 60. Examplepatrick$ git status# On branch masternothing to commit (working directory clean)patrick$ git stash apply# On branch master# Changes not staged for commit:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes inworking directory)## modified: README#
    • 61. DeploymentsCode pulled from repository or build archiveCode not checked in will be overwrittenSoon all production servers will be IT accessonly
    • 62. Resourceshttp://help.github.comhttp://git-scm.com/book Definitive guide written by a Github devhttp://net.tutsplus.com/tutorials/other/easy-version-control-with-git/ Much more basic
    • 63. GUI ClientsTower http://www.git-tower.com/SourceTree http://www.sourcetreeapp.com/Github for Mac http://mac.github.com/
    • 64. Questions?
    • 65. Githubhttp://github.com
    • 66. Context
    • 67. Activity Feed
    • 68. Main Repository Page
    • 69. Clone URL
    • 70. Branches
    • 71. Commit History
    • 72. Commit History
    • 73. Change Sets
    • 74. Excellent Help Docshttp://help.git.com
    • 75. Questions?
    • 76. Slides Available