O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

How Do I Contribute?

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Próximos SlideShares
Introducción a git y GitHub
Introducción a git y GitHub
Carregando em…3
×

Confira estes a seguir

1 de 110 Anúncio

How Do I Contribute?

Baixar para ler offline

This session was presented at MacTech 2014 in Los Angeles, California. Session description follows:

Git and GitHub have changed the way we can collaborate with others on code-based projects, but it can be intimidating at first. How does this all work? We will cover the basics of Git and how to escape some of its pitfalls, and we will review some of the tools and processes available to those wanting to start or contribute to an open-source project, which isn't Git-specific. Writing code is only part of it!

This session was presented at MacTech 2014 in Los Angeles, California. Session description follows:

Git and GitHub have changed the way we can collaborate with others on code-based projects, but it can be intimidating at first. How does this all work? We will cover the basics of Git and how to escape some of its pitfalls, and we will review some of the tools and processes available to those wanting to start or contribute to an open-source project, which isn't Git-specific. Writing code is only part of it!

Anúncio
Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Semelhante a How Do I Contribute? (20)

Anúncio

Mais recentes (20)

Anúncio

How Do I Contribute?

  1. 1. How Do I Contribute? Tim Sutton Concordia University, Montreal
  2. 2. IT Operations
  3. 3. IT Operations Development
  4. 4. Source Control Management (SCM)
  5. 5. Git
  6. 6. Git Mercurial
  7. 7. commit 922ae4e4d558cf5c47e8a815abf2f6fe7c25a409 Author: Graham Gilbert <graham@grahamgilbert.com> Date: Mon Sep 1 15:03:34 2014 +0100 Symlink for backwards compatibility diff --git a/Dockerfile b/Dockerfile index ee3529b..0f64d91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,6 +57,7 @@ CMD ["/run.sh"] EXPOSE 8000 VOLUME ["$APP_DIR/plugins", "$APP_DIR/sal/settings.py"] +RUN mkdir -p /home/app +RUN ln -s $APP_DIR /home/app/sal RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
  8. 8. commit 071822982716877cf37634df6b0ec5cb3754545d Author: Timothy Sutton <tim@synthist.net> Date: Fri Oct 24 14:59:57 2014 -0400 Install Mavericks: bump to 10.9.5 diff --git a/Workflows/559B48FA-A325-4E9C-A7D2-9AE0CCCD8195.plist b/Workflows/559B48FA- index c656813..bef4c33 100755 --- a/Workflows/559B48FA-A325-4E9C-A7D2-9AE0CCCD8195.plist +++ b/Workflows/559B48FA-A325-4E9C-A7D2-9AE0CCCD8195.plist @@ -17,7 +17,7 @@ <key>ignoreinstallfailure</key> <string>NO</string> <key>package</key> - <string>InstallOSX_10.9.4_13E28_custom_autobuild.pkg</string> + <string>InstallOSX_10.9.5_13F34_custom_autobuild.pkg</string> <key>postponedinstall</key> <string>NO</string> <key>targetname</key> @@ -31,6 +31,6 @@ </dict> </dict> <key>title</key> -<string> Upgrade to OS X Mavericks (10.9.4)</string> +<string> Upgrade to OS X Mavericks (10.9.5)</string> </dict> </plist>
  9. 9. Good housekeeping
  10. 10. Know where you are
  11. 11. Resources 2nd edition released mid-October http://git-scm.com/book https://github.com/progit/progit2
  12. 12. Resources http://stackoverflow.com/questions/tagged/git?sort=votes
  13. 13. Resources https://try.github.io http://onlywei.github.io/ explain-git-with-d3
  14. 14. Resources https://try.github.io http://onlywei.github.io/ explain-git-with-d3
  15. 15. GUI SourceTree GitHub for MacGitX-dev Tower
  16. 16. http://git-scm.com/download/gui/mac SourceTree GitHub for MacGitX-dev Tower
  17. 17. Practice, practice
  18. 18. GitHub
  19. 19. GitHub
  20. 20. GitHub
  21. 21. GitHub
  22. 22. Contributor Maintainer
  23. 23. Contributor Maintainer
  24. 24. Submitting changes $
  25. 25. Submitting changes $
  26. 26. Submitting changes $ git clone https://github.com/timsutton/munki-conditions
  27. 27. Submitting changes $ Cloning into 'munki-conditions'... remote: Counting objects: 28, done. remote: Total 28 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (28/28), done. Checking connectivity... done. git clone https://github.com/timsutton/munki-conditions
  28. 28. $ Submitting changes
  29. 29. $ git:(master) >$ cd munki-conditions Submitting changes
  30. 30. $ git:(master) >$ cd munki-conditions Submitting changes cp /new/munki/condition/virtual .
  31. 31. $ git:(master) >$ git:(master) ✗ >$ cd munki-conditions Submitting changes cp /new/munki/condition/virtual .
  32. 32. $ git:(master) >$ git:(master) ✗ >$ git status cd munki-conditions Submitting changes cp /new/munki/condition/virtual .
  33. 33. $ git:(master) >$ git:(master) ✗ >$ On branch master Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) virtual nothing added to commit but untracked files present (use "git add" to track) git status cd munki-conditions Submitting changes cp /new/munki/condition/virtual .
  34. 34. git:(master) ✗ >$ Submitting changes
  35. 35. git:(master) ✗ >$ git branch add-virtual git:(master) ✗ >$ Submitting changes
  36. 36. git:(master) ✗ >$ git branch add-virtual git:(master) ✗ >$ git checkout add-virtual Switched to branch 'add-virtual' git:(add-virtual) ✗ >$ Submitting changes
  37. 37. git:(master) ✗ >$ git branch add-virtual git:(master) ✗ >$ git checkout add-virtual Switched to branch 'add-virtual' git:(add-virtual) ✗ >$ git add virtual git:(add-virtual) ✗ >$ Submitting changes
  38. 38. git:(master) ✗ >$ git branch add-virtual git:(master) ✗ >$ git checkout add-virtual Switched to branch 'add-virtual' git:(add-virtual) ✗ >$ git add virtual git:(add-virtual) ✗ >$ git status Submitting changes
  39. 39. git:(master) ✗ >$ git branch add-virtual git:(master) ✗ >$ git checkout add-virtual Switched to branch 'add-virtual' git:(add-virtual) ✗ >$ git add virtual git:(add-virtual) ✗ >$ git status On branch add-virtual Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: virtual git:(add-virtual) ✗ >$ Submitting changes
  40. 40. git:(master) ✗ >$ git branch add-virtual git:(master) ✗ >$ git checkout add-virtual Switched to branch 'add-virtual' git:(add-virtual) ✗ >$ git add virtual git:(add-virtual) ✗ >$ git status On branch add-virtual Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: virtual git:(add-virtual) ✗ >$ git commit Submitting changes
  41. 41. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch add-virtual # Changes to be committed: # new file: virtual # Submitting changes
  42. 42. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch add-virtual # Changes to be committed: # new file: virtual # Adding new ‘virtual’ condition Submitting changes
  43. 43. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch add-virtual # Changes to be committed: # new file: virtual # Adding new ‘virtual’ condition - returns ‘physical’ on a physical Mac, ‘vmware’ on Fusion Submitting changes
  44. 44. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch add-virtual # Changes to be committed: # new file: virtual # Adding new ‘virtual’ condition - returns ‘physical’ on a physical Mac, ‘vmware’ on Fusion :wq Submitting changes
  45. 45. [add-virtual c633790] Adding new 'virtual' condition 1 file changed, 20 insertions(+) create mode 100755 virtual Submitting changes
  46. 46. [add-virtual c633790] Adding new 'virtual' condition 1 file changed, 20 insertions(+) create mode 100755 virtual git:(add-virtual) >$ Submitting changes
  47. 47. [add-virtual c633790] Adding new 'virtual' condition 1 file changed, 20 insertions(+) create mode 100755 virtual git:(add-virtual) >$ git status On branch add-virtual nothing to commit, working directory clean Submitting changes
  48. 48. Submitting changes
  49. 49. Submitting changes
  50. 50. git:(add-virtual) >$ Submitting changes
  51. 51. git:(add-virtual) >$ git remote add mactech https://github.com/mactech2014/munki-conditions git:(add-virtual) >$ Submitting changes
  52. 52. git:(add-virtual) >$ git remote add mactech https://github.com/mactech2014/munki-conditions git:(add-virtual) >$ git push mactech add-virtual Counting objects: 3, done. Delta compression using up to 8 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 716 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) To https://github.com/mactech2014/munki-conditions * [new branch] add-virtual -> add-virtual Submitting changes
  53. 53. Submitting changes
  54. 54. Submitting changes
  55. 55. Submitting changes
  56. 56. Submitting changes
  57. 57. Pulling in changes git:(master) >$
  58. 58. Pulling in changes git:(master) >$
  59. 59. Pulling in changes git:(master) >$ git remote add mactech https://github.com/mactech2014/munki-conditions git:(master) >$
  60. 60. Pulling in changes git:(master) >$ git remote add mactech https://github.com/mactech2014/munki-conditions git:(master) >$ git fetch mactech From https://github.com/mactech2014/munki-conditions * [new branch] add-virtual -> mactech/add-virtual * [new branch] master -> mactech/master
  61. 61. Pulling in changes git:(master) >$
  62. 62. Pulling in changes git:(master) >$ git log mactech/add-virtual commit c633790b8405d30d2681ae6b912cf7d89dcad5bc Author: MacTech 2014 <2014@mactech.com> Date: Thu Oct 23 14:50:08 2014 -0400 Adding new 'virtual' condition - returns 'physical' on a physical Mac, 'vmware' on Fusion
  63. 63. commit c633790b8405d30d2681ae6b912cf7d89dcad5bc Author: MacTech 2014 <2014@mactech.com> Date: Thu Oct 23 14:50:08 2014 -0400 Adding new 'virtual' condition - returns 'physical' on a physical Mac, 'vmware' on Fusion diff --git a/virtual b/virtual new file mode 100755 index 0000000..7697495 --- /dev/null +++ b/virtual @@ -0,0 +1,20 @@ +#!/bin/sh +# Pulling in changes git:(master) >$ git log --patch mactech/add-virtual
  64. 64. index 0000000..7697495 --- /dev/null +++ b/virtual @@ -0,0 +1,20 @@ +#!/bin/sh +# +# writes a condition: 'virtual', which can be: +# - 'physical' if a physical machine +# - 'vmware' if a VMware VM +# +# Designed to be analogous to the 'virtual' Facter fact. No +# other virtualization platforms are supported currently. + +DEFAULTS=/usr/bin/defaults +MUNKI_DIR=$("${DEFAULTS}" read /Library/Preferences/ManagedInstalls ManagedInstallDir) +COND_DOMAIN="${MUNKI_DIR}/ConditionalItems" +KEY="virtual" + +VALUE="physical" +if system_profiler SPHardwareDataType | grep Boot ROM | grep VMW; then + VALUE="vmware" +fi + +"${DEFAULTS}" write "${COND_DOMAIN}" "${KEY}" "${VALUE}" Pulling in changes
  65. 65. Pulling in changes git:(master) >$
  66. 66. Pulling in changes git:(master) >$ git merge mactech/add-virtual Updating 34c2366..c633790 Fast-forward virtual | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 virtual git:(master) >$
  67. 67. Pulling in changes git:(master) >$ git merge mactech/add-virtual Updating 34c2366..c633790 Fast-forward virtual | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 virtual git:(master) >$ git log -1 commit c633790b8405d30d2681ae6b912cf7d89dcad5bc Author: MacTech 2014 <2014@mactech.com> Date: Thu Oct 23 14:50:08 2014 -0400 Adding new 'virtual' condition - returns ‘physical’ on a physical Mac, ‘vmware’ on Fusion
  68. 68. Pulling in changes
  69. 69. Pulling in changes git:(master) >$
  70. 70. Pulling in changes git:(master) >$ git push Counting objects: 3, done. Delta compression using up to 8 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 716 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) To https://github.com/timsutton/munki-conditions 34c2366..c633790 master -> master git:(master) >$
  71. 71. Pulling in changes
  72. 72. Pulling in changes
  73. 73. Guidelines, ProTips
  74. 74. Just do it CC BY 2.0 chan yiu hao https://flic.kr/p/kiHuDG
  75. 75. Topic branches
  76. 76. Topic branches
  77. 77. Topic branches http://stackoverflow.com/questions/ 1628563/move-the-most-recent- commits-to-a-new-branch-with-git
  78. 78. Follow coding style
  79. 79. git status git diff --staged git diff --check
  80. 80. Referencing code on GitHub
  81. 81. Referencing code on GitHub
  82. 82. Referencing code on GitHub https://help.github.com/articles/writing-on-github/ https://help.github.com/articles/github-flavored-markdown/
  83. 83. https://github.com/autopkg/recipes/blob/mozilla-cdn-s3/ Mozilla/MozillaURLProvider.py Referencing code on GitHub
  84. 84. https://github.com/autopkg/recipes/blob/mozilla-cdn-s3/ Mozilla/MozillaURLProvider.py#L93-L96 Referencing code on GitHub
  85. 85. https://github.com/autopkg/recipes/blob/mozilla-cdn-s3/ Mozilla/MozillaURLProvider.py#L93-L96 Referencing code on GitHub
  86. 86. https://github.com/autopkg/recipes/blob/ 2a9594fcc660b812cd917e5c85698585eed04fed/Mozilla/ MozillaURLProvider.py#L93-L96 Referencing code on GitHub
  87. 87. One-time pull git pull <url> <branch>
  88. 88. One-time pull git pull https://github.com/newspaperclub/osx-vm-templates easier-renaming-of-vagrant-user
  89. 89. Checking out pull requests $
  90. 90. Checking out pull requests $ $ git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'
  91. 91. Checking out pull requests $ git pull $ git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'
  92. 92. Checking out pull requests remote: Counting objects: 36, done. remote: Compressing objects: 100% (27/27), done. remote: Total 36 (delta 15), reused 19 (delta 9) Unpacking objects: 100% (36/36), done. From https://github.com/timsutton/osx-vm-templates * [new ref] refs/pull/1/head -> origin/pr/1 * [new ref] refs/pull/16/head -> origin/pr/16 * [new ref] refs/pull/2/head -> origin/pr/2 * [new ref] refs/pull/3/head -> origin/pr/3 * [new ref] refs/pull/4/head -> origin/pr/4 * [new ref] refs/pull/6/head -> origin/pr/6 * [new ref] refs/pull/8/head -> origin/pr/8 $ git pull $ git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*' $
  93. 93. Checking out pull requests remote: Counting objects: 36, done. remote: Compressing objects: 100% (27/27), done. remote: Total 36 (delta 15), reused 19 (delta 9) Unpacking objects: 100% (36/36), done. From https://github.com/timsutton/osx-vm-templates * [new ref] refs/pull/1/head -> origin/pr/1 * [new ref] refs/pull/16/head -> origin/pr/16 * [new ref] refs/pull/2/head -> origin/pr/2 * [new ref] refs/pull/3/head -> origin/pr/3 * [new ref] refs/pull/4/head -> origin/pr/4 * [new ref] refs/pull/6/head -> origin/pr/6 * [new ref] refs/pull/8/head -> origin/pr/8 $ git pull $ git config --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*' $ git checkout origin/pr/16 Note: checking out 'origin/pr/16'.
  94. 94. https://help.github.com/articles/checking-out-pull- requests-locally http://git-scm.com/book/en/v2/GitHub-Maintaining-a- Project#Managing-Pull-Requests http://nedbatchelder.com/blog/201407/ fetching_github_pull_requests.html Checking out pull requests
  95. 95. TextMate mode (press ’t’) Always make a topic branch Keep commits logical
  96. 96. TextMate mode (press ’t’) Always make a topic branch Keep commits logical
  97. 97. Shell integration https://github.com/jimeh/git-aware-prompt
  98. 98. Shell integration https://github.com/jimeh/git-aware-prompt Oh-My-ZSH (default robbyrussel theme) http://ohmyz.sh
  99. 99. macops.ca/mactech-2014

×