GIT Introduction

From DevSummit
Revision as of 22:58, 23 November 2015 by Jucsanch (talk | contribs) (Created page with "Two Git groups: David and Nazario ==Git for beginners with Nazario== Assuming some use of Git and starting at the bottom level. ===Resources=== *Video "Git for 4-year-olds"...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Two Git groups: David and Nazario

Git for beginners with Nazario

Assuming some use of Git and starting at the bottom level.

Resources

  • Video "Git for 4-year-olds"
  • Article "Understanding Git conceptually"
  • Practice: Git is source control; off-line; keeping track of changes;

Locally On Your Computer

Git as software tool installed on your computer.

  • There are graphical tools as well as command line.
  • Starting with cmd line...
    • Creating folder and file in folder -- then turn into a repository using "git init"
    • Start locally. Type "git status"
    • On branch master
    • see untracked file, To add to repository, "git add -A"
      • "add" is not the same as "commit" it is an intermediate step (like adding to shopping cart but not yet committing to buying)
      • "-A" means all additions, changes and deletions.
      • git commit -m with "message for the commit"
    • git show
    • git diff -- filename.txt
      • will show the difference between the earlier committed file and the modified (saved) file (labeled a and b).
    • Committed files reside in a "secret" folder (.git)
      • Must Add before Commit (must be in shopping cart before purchase!)
      • Commit is a cohesive collection of Adds that all relate to each other.
    • binaries (pdf, png, etc.)
    • Empty folders are ignored, git only cares about files.
    • If you want a folder to be in hte Commit create an empty file called .gitkeep (by convention)
    • Use touch command to create empty file with leading dot
    • git log
    • shows log of all changes; every Commit has a unique number
    • HEAD
      • Copy the Commit number and type
      • git checkout number
      • "you are in detached HEAD"
      • HEAD is your time machine; checkout a commit will take you back in time, and git log will show you only changes made up to this point in time.
      • To get back to the present time type
      • git checkout master (master is the name of the branch you are in)