Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to git

1d9c18afb26d5fef542bcfb74d89722d?s=47 sarva
March 26, 2014

Introduction to git

1d9c18afb26d5fef542bcfb74d89722d?s=128

sarva

March 26, 2014
Tweet

More Decks by sarva

Other Decks in Programming

Transcript

  1. git

  2. What is git? • Version control system • Works well

    with text files - programs, LaTeX, beamer • Created by Linus
  3. git terminology • Repository = Collection of files + change

    history • commit = Action of changing repo state • clone = Making a copy of a repo • Remote repository = Repo in another location ◦ push = Push changes in local repo to a remote repo ◦ pull = Pull changes in a remote repo to a local repo • Merging = Reconciling conflicting changes
  4. Creating a repository • git init <repo-name> • Demo

  5. Checking repository status • git status • Demo

  6. Committing to a repository • Two step procedure ◦ git

    add <file-name> ◦ git commit • Demo Repository Unstaged changes Staging Area git add git commit
  7. Viewing commit history • git log • gitk • Demo

  8. Configuring user details • git config --global user.name “Name” •

    git config --global user.email “Email” • Demo
  9. Storing a repository on the cloud • Create a repo

    on www.bitbucket.org • cd /path/to/my/local/repo • git remote add origin <bitbucket-repo> • git push -u origin --all
  10. Cloning a repository • git clone <repo-location> • Demo

  11. Pushing to a remote repository • git push <remote-repo-location> •

    Demo
  12. Pulling from a remote repository • git pull <remote-repo-location> •

    Demo
  13. Handling conflicting changes • Demo

  14. Further Reading http://git-scm.com/book