an intermediate look at git github
play

An Intermediate Look at Git + GitHub U of T Scientific Coders - PowerPoint PPT Presentation

An Intermediate Look at Git + GitHub U of T Scientific Coders University of Toronto October 1, 2015 fd7a4e4 : gh-pages Create 2015-10-08-Coworking4.markd... c3cb768 : Merge pull request #41 from mbonsma/gh-pages e2764b7 : Incorporated PR comments


  1. An Intermediate Look at Git + GitHub U of T Scientific Coders University of Toronto October 1, 2015 fd7a4e4 : gh-pages Create 2015-10-08-Coworking4.markd... c3cb768 : Merge pull request #41 from mbonsma/gh-pages e2764b7 : Incorporated PR comments into Biopython/less... d212bdd : Merge remote-tracking branch ‘upstream/gh-p... 85791b7 : Added start and end time to event post b83b3e0 : Merge remote-tracking branch ‘upstream/gh-p... 0b7d78c : Create 2015-10-01-MoreObGit.markdown

  2. Outline 1 Review Viewing History 2 Branching 3 Collaborating with Others 4 1 / 13

  3. Section 1 Review 2 / 13

  4. Review Configure your git client ( git config user.name + user.email ) Create a git repository ( git init ) 3 / 13

  5. Review Configure your git client ( git config user.name + user.email ) Create a git repository ( git init ) Working Repository Directory Index/ History my_project/ Staging Area .git/ foo/ bar/ 10 baz.txt qux.txt 9 ... 8 3 / 13

  6. Review Configure your git client ( git config user.name + user.email ) Create a git repository ( git init ) Working Repository Directory Index/ History my_project/ Staging Area .git/ foo/ (Snapshot) bar/ 10 foo/ baz.txt qux.txt baz.txt 9 ... ... 8 Start tracking a file with git ( git add ) 3 / 13

  7. Review Configure your git client ( git config user.name + user.email ) Create a git repository ( git init ) Working Repository Directory Index/ History my_project/ Staging Area .git/ foo/ (Snapshot) bar/ 10 foo/ baz.txt qux.txt baz.txt 9 ... ... 8 Start tracking a file with git ( git add ) Commit changes to the history ( git commit ) 3 / 13

  8. Review Configure your git client ( git config user.name + user.email ) Create a git repository ( git init ) Working Repository Directory Index/ History my_project/ Staging Area .git/ foo/ (Snapshot) bar/ 10 foo/ baz.txt qux.txt baz.txt 9 ... ... 8 Start tracking a file with git ( git add ) Commit changes to the history ( git commit ) Check what’s going on ( git status ) Compare a file with the one in the history ( git diff ) Look into your history ( git log ) 3 / 13

  9. Section 2 Viewing History 4 / 13

  10. Viewing History Viewing the log allows you to “see” history: git log 5 / 13

  11. Viewing History Viewing the log allows you to “see” history: git log git log <start>..<end> git log -- <file> git log --oneline git log --graph git log --graph --decorate 5 / 13

  12. Viewing History Viewing the log allows you to “see” history: git log git log <start>..<end> git log -- <file> git log --oneline git log --graph git log --graph --decorate git blame <file> 5 / 13

  13. Viewing History Viewing the log allows you to “see” history: git log git log <start>..<end> git log -- <file> git log --oneline git log --graph git log --graph --decorate git blame <file> gitk + gitg + other viewers 5 / 13

  14. Section 3 Branching 6 / 13

  15. Branches What are branches? Divergent commits (two commits with the same parent) could be considered “virtual” branches 7 / 13

  16. Branches What are branches? Divergent commits (two commits with the same parent) could be considered “virtual” branches Branches are simply a named pointer to a commit 7 / 13

  17. Branches What are branches? Divergent commits (two commits with the same parent) could be considered “virtual” branches Branches are simply a named pointer to a commit Branches automatically move forward as commits are made 7 / 13

  18. Branches What are branches? Divergent commits (two commits with the same parent) could be considered “virtual” branches Branches are simply a named pointer to a commit Branches automatically move forward as commits are made Why use them? 7 / 13

  19. Branches What are branches? Divergent commits (two commits with the same parent) could be considered “virtual” branches Branches are simply a named pointer to a commit Branches automatically move forward as commits are made Why use them? They’re cheap! Just pointers. No heavy changes, e.g., an extra directory in svn. 7 / 13

  20. Branches What are branches? Divergent commits (two commits with the same parent) could be considered “virtual” branches Branches are simply a named pointer to a commit Branches automatically move forward as commits are made Why use them? They’re cheap! Just pointers. No heavy changes, e.g., an extra directory in svn. To keep experimental work apart 7 / 13

  21. Branches What are branches? Divergent commits (two commits with the same parent) could be considered “virtual” branches Branches are simply a named pointer to a commit Branches automatically move forward as commits are made Why use them? They’re cheap! Just pointers. No heavy changes, e.g., an extra directory in svn. To keep experimental work apart To separate trials 7 / 13

  22. Branches What are branches? Divergent commits (two commits with the same parent) could be considered “virtual” branches Branches are simply a named pointer to a commit Branches automatically move forward as commits are made Why use them? They’re cheap! Just pointers. No heavy changes, e.g., an extra directory in svn. To keep experimental work apart To separate trials To ease collaboration 7 / 13

  23. Branches Managing branches: git branch <name> [commit] git branch -d <name> git branch [-l] 8 / 13

  24. Branches Managing branches: git branch <name> [commit] git branch -d <name> git branch [-l] Switching branches: git checkout <branch name> git checkout -b <branch name> [commit] — Create and switch in one go 8 / 13

  25. Branches Managing branches: git branch <name> [commit] git branch -d <name> git branch [-l] Switching branches: git checkout <branch name> git checkout -b <branch name> [commit] — Create and switch in one go Merging branches: git merge <other branch name> git merge --ff-only <other branch name> git merge --no-ff <other branch name> 8 / 13

  26. Section 4 Collaborating with Others 9 / 13

  27. Clones and Remotes Clones are complete copies of a repository’s history (i.e., excluding the index and working directory) 10 / 13

  28. Clones and Remotes Clones are complete copies of a repository’s history (i.e., excluding the index and working directory) git clone <URI> 10 / 13

  29. Clones and Remotes Clones are complete copies of a repository’s history (i.e., excluding the index and working directory) git clone <URI> Remotes are pointers to other clones 10 / 13

  30. Clones and Remotes Clones are complete copies of a repository’s history (i.e., excluding the index and working directory) git clone <URI> Remotes are pointers to other clones git remote [-v] git remote add <name> <URI> git remote rm <name> Local branches can track remote branches git branch -u <remote branch> <local branch> 10 / 13

  31. Clones and Remotes Clones are complete copies of a repository’s history (i.e., excluding the index and working directory) git clone <URI> Remotes are pointers to other clones git remote [-v] git remote add <name> <URI> git remote rm <name> Local branches can track remote branches git branch -u <remote branch> <local branch> You are responsible for syncing git push [<remote>] [<branch>] git fetch [<remote>] git pull [<remote>] — fetch + merge 10 / 13

  32. GitHub Example

  33. Section 5 Advanced Topics 12 / 13

  34. Advanced Topics git add --patch 13 / 13

  35. Advanced Topics git add --patch git rebase 13 / 13

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend