• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Git102
 

Git102

on

  • 1,215 views

Intro to Git slide deck.

Intro to Git slide deck.

Covers Forking, pushing and pulling to Github, Pull requests

Statistics

Views

Total Views
1,215
Views on SlideShare
1,210
Embed Views
5

Actions

Likes
2
Downloads
13
Comments
0

3 Embeds 5

http://www.linkedin.com 3
http://www.slideshare.net 1
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • This shows you what branch you’re on. It will show what files are staged (none shown here) It will show what files changed (AUTHORS listed here)
  • I like to do this so I have a local branch of the upstream updates.

Git102 Git102 Presentation Transcript

  • Our project on GitHub
    • http: //github . com/jasonnoble/event_scheduler
      • Click Fork
  • Fork Command
    • Fork is a GitHub thing, it’s not a Git command
    • Clicking fork basically copies a repo on Github into your Github account
    • This provides a public repo that you have access to push your changes to
  • 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
  • Your project on GitHub
    • http://github.com/your-user-name/event_scheduler
  • Clone your Repo
    • git clone [email_address] .com: your-user-name/event_scheduler . git
    • cd event_scheduler
    • git pull
      • Should say “Already up-to-date”
    • This clone command adds a remote repo “origin” (explained in detail later)
    • A clone is the entire history of the Git Repo
      • History of all changes
      • Log messages
  • Modify a file
    • vi (or your favorite editor) AUTHORS
    • Add your name
    • Save the file
  • Git diff
    • git diff
    • Shows what has changed since your last commit
  • Git Status
    • Shows the status of your git repo / working directory
    • git status
  • Git add
    • Stages files to be committed
    • git add AUTHORS
  • Git Commit
    • Commit your changes
    • git commit -v
    • Options:
      • a Add all known files
      • v Verbose (show diff in editor)
      • m Command line commit message
  • Git commit (cont.)
  • 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
  • Git Push
    • Push your changes to GitHub
    • git push origin master
  • 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
  • Add upstream
    • In order to pull updates from other sources, you need to add a remote server
  • Add upstream (cont.)
    • git remote add upstream git://github.com/jasonnoble/event_scheduler.git
      • “ upstream” is whatever you want to call it
      • “ upstream” for the repo you forked from is a GitHub convention
    • git fetch upstream
      • Fetches references from upstream
  • Create local branch
    • git checkout --track -b upstream-master upstream/master
      • upstream-master is what you will call it locally
  • Pull remote changes
    • git checkout upstream-master
    • git pull
      • pull updates from the remote
  • Show diffs between branches
    • git show-branch
  • Merge branches
    • git checkout master
    • git merge upstream-master
      • Merges any changes committed to upstream-master into the master branch
    • After merge, do a git push to push that merge to your public repo on GitHub
  • Pulling from Upstream Lab
    • I will commit a change to my public repo (upstream)
    • You add upstream as a remote repo
    • Pull from the repo to get the changes
  • Pushing/Pulling to other remote repos Jasonnoble/ event_scheduler your-user-name/ event_scheduler hosh/ event_scheduler Other forks event_scheduler Local Repo upstream origin hosh git push hosh master git pull hosh master Allowed by default Requires permission Remotes: origin upstream hosh
  • Practice makes perfect
    • Find a pair to work with
    • Add their remote repo
      • git remote add _____ git://github…..
    • Fetch refs
      • git fetch _______
    • Create Branch
      • git checkout --track -b ______ _____/master
  • Practice makes perfect (Cont.)
    • Make some changes, push them to origin/master and have your pair pull those changes
    • Switch roles and you pull changes they’ve pushed
    • Play with the “pull request” feature of GitHub