Your SlideShare is downloading. ×
0
 
Remote repos process (single committer) Public Repo Located on Server (Github) Private Repo Located on your local machine ...
Remote repos process (multiple committers) Public Repo Located on Server (Github) Private Repo Located on your local machi...
Remote repos process (multiple committers) Public Repo Located on Server (Github) Private Repo Located on your local machi...
Public/Private Repo Setup Jasonnoble/ event_scheduler (on GitHub) your-user-name/ event_scheduler (on GitHub) hosh/ event_...
Open source project  on GitHub <ul><li>http://github.com/jasonnoble/event_scheduler </li></ul><ul><ul><li>Click Fork </li>...
Fork Command <ul><li>Fork is a GitHub thing, it’s not a Git command </li></ul><ul><li>Clicking fork basically copies a rep...
Your project on GitHub <ul><li>http://github.com/your-user-name/event_scheduler </li></ul>
Clone your Repo <ul><li>git clone  git@github.com:your-user-name/event_scheduler.git </li></ul><ul><li>cd event_scheduler ...
Pushing/Pulling to upstream Jasonnoble/event_scheduler your-user-name/event_scheduler hosh/event_scheduler Other forks eve...
Add upstream <ul><li>In order to pull updates from other sources, you need to add a remote server </li></ul>
Add upstream (cont.) <ul><li>git remote add upstream  git://github.com/jasonnoble/event_scheduler.git </li></ul><ul><ul><l...
Create local branch <ul><li>git checkout --track -b upstream-master upstream/master </li></ul><ul><ul><li>upstream-master ...
Pull remote changes <ul><li>git checkout upstream-master </li></ul><ul><li>git pull </li></ul><ul><ul><li>pull updates fro...
Show diffs between branches <ul><li>git show-branch </li></ul>
Merge branches <ul><li>git checkout master </li></ul><ul><li>git merge upstream-master </li></ul><ul><ul><li>Merges any ch...
Pulling from Upstream Lab <ul><li>I will commit a change to my public repo (upstream) </li></ul><ul><li>You add upstream a...
Modify a file <ul><li>vi (or your favorite editor) AUTHORS </li></ul><ul><li>Add your name </li></ul><ul><li>Save the file...
Pushing/Pulling to Origin Jasonnoble/ event_scheduler your-user-name/ event_scheduler hosh/ event_scheduler Other forks ev...
Git Push <ul><li>Push your changes to GitHub </li></ul><ul><li>git push origin master </li></ul>
Pull Requests <ul><li>After you push new code to your forked repo, you can request others pull your requests </li></ul><ul...
Pull Requests (cont.)
Upcoming SlideShare
Loading in...5
×

Git Atlrug

1,071

Published on

Intro to Git slide deck give as a presentation to the Atlanta Ruby Users Group.

Covers Forking, pushing and pulling to Github, Pull requests

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,071
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • The bottom commit loop happens frequently. Pushing the the remote happens “occasionally”
  • You commit a change and push to your public repo Bob can then “pull” your change to his repo
  • Bob commits a change and pushes to your public repo You can then “pull” his change to your local repo
  • I like to do this so I have a local branch of the upstream updates.
  • Transcript of "Git Atlrug"

    1. 2. Remote repos process (single committer) Public Repo Located on Server (Github) Private Repo Located on your local machine git push Make file changes Stage Changes Commit Changes git add filename git commit -m ‘…’ vi filename
    2. 3. Remote repos process (multiple committers) Public Repo Located on Server (Github) Private Repo Located on your local machine 1) git push Make file changes Stage Changes Commit Changes git add filename git commit -m ‘…’ vi filename Bob’s Private Repo Located on Bob’s local machine 2) git pull
    3. 4. Remote repos process (multiple committers) Public Repo Located on Server (Github) Private Repo Located on your local machine 2) git pull Bob’s Private Repo Located on Bob’s local machine Make file changes Stage Changes Commit Changes git add filename git commit -m ‘…’ vi filename 1) git push
    4. 5. Public/Private Repo Setup Jasonnoble/ event_scheduler (on GitHub) your-user-name/ event_scheduler (on GitHub) hosh/ event_scheduler (on GitHub) Fork Other Public Repos event_scheduler Local Repo Clone Your Public Repo Project Public Repo stonean/ event_scheduler (on GitHub) Public Repo Private Repo
    5. 6. Open source project on GitHub <ul><li>http://github.com/jasonnoble/event_scheduler </li></ul><ul><ul><li>Click Fork </li></ul></ul>
    6. 7. Fork Command <ul><li>Fork is a GitHub thing, it’s not a Git command </li></ul><ul><li>Clicking fork basically copies a repo on Github into your Github account </li></ul><ul><li>This provides a public repo that you have access to push your changes to </li></ul>
    7. 8. Your project on GitHub <ul><li>http://github.com/your-user-name/event_scheduler </li></ul>
    8. 9. Clone your Repo <ul><li>git clone git@github.com:your-user-name/event_scheduler.git </li></ul><ul><li>cd event_scheduler </li></ul><ul><li>git pull </li></ul><ul><ul><li>Should say “Already up-to-date” </li></ul></ul><ul><li>This clone command adds a remote repo “origin” (explained in detail later) </li></ul><ul><li>A clone is the entire history of the Git Repo </li></ul><ul><ul><li>History of all changes </li></ul></ul><ul><ul><li>Log messages </li></ul></ul>
    9. 10. Pushing/Pulling to upstream Jasonnoble/event_scheduler your-user-name/event_scheduler hosh/event_scheduler Other forks event_scheduler Local Repo upstream origin hosh Allowed by default Requires permission git push upstream master git pull upstream master Remotes: origin upstream hosh
    10. 11. Add upstream <ul><li>In order to pull updates from other sources, you need to add a remote server </li></ul>
    11. 12. Add upstream (cont.) <ul><li>git remote add upstream git://github.com/jasonnoble/event_scheduler.git </li></ul><ul><ul><li>“ upstream” is whatever you want to call it </li></ul></ul><ul><ul><li>“ upstream” for the repo you forked from is a GitHub convention </li></ul></ul><ul><li>git fetch upstream </li></ul><ul><ul><li>Fetches references from upstream </li></ul></ul>
    12. 13. Create local branch <ul><li>git checkout --track -b upstream-master upstream/master </li></ul><ul><ul><li>upstream-master is what you will call it locally </li></ul></ul>
    13. 14. Pull remote changes <ul><li>git checkout upstream-master </li></ul><ul><li>git pull </li></ul><ul><ul><li>pull updates from the remote </li></ul></ul>
    14. 15. Show diffs between branches <ul><li>git show-branch </li></ul>
    15. 16. Merge branches <ul><li>git checkout master </li></ul><ul><li>git merge upstream-master </li></ul><ul><ul><li>Merges any changes committed to upstream-master into the master branch </li></ul></ul><ul><li>After merge, do a git push to push that merge to your public repo on GitHub </li></ul>
    16. 17. Pulling from Upstream Lab <ul><li>I will commit a change to my public repo (upstream) </li></ul><ul><li>You add upstream as a remote repo </li></ul><ul><li>Pull from the repo to get the changes </li></ul>
    17. 18. Modify a file <ul><li>vi (or your favorite editor) AUTHORS </li></ul><ul><li>Add your name </li></ul><ul><li>Save the file </li></ul><ul><li>Commit the change </li></ul>
    18. 19. Pushing/Pulling to Origin Jasonnoble/ event_scheduler your-user-name/ event_scheduler hosh/ event_scheduler Other forks event_scheduler Local Repo git pull origin git push Allowed by default Requires permission Remotes: origin upstream hosh
    19. 20. Git Push <ul><li>Push your changes to GitHub </li></ul><ul><li>git push origin master </li></ul>
    20. 21. Pull Requests <ul><li>After you push new code to your forked repo, you can request others pull your requests </li></ul><ul><li>http://github.com/your-user-name/event_scheduler </li></ul><ul><li>Click Pull Request </li></ul><ul><li>Enter a quick message about what you changed </li></ul><ul><li>Enter receipients </li></ul><ul><ul><li>All users who have forked upstream are listed </li></ul></ul><ul><ul><li>Check users as requested </li></ul></ul>
    21. 22. Pull Requests (cont.)
    1. A particular slide catching your eye?

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

    ×