Skip to content

Instantly share code, notes, and snippets.

@vladd-png
Last active August 22, 2019 19:17
Show Gist options
  • Save vladd-png/2c9f85c474cb9009aed8f921064121df to your computer and use it in GitHub Desktop.
Save vladd-png/2c9f85c474cb9009aed8f921064121df to your computer and use it in GitHub Desktop.
Beginners Guide to Git

Introduction to Git and GitHub

A basic beginners guide that should not replace the original guide online

Git is a Version Control System (VCS) that allows you to save work on your project, and reference previous states of a project when needed.


Essentials Everyone will need to Begin their Journey with Git

  • Github Account
  • Git loaded onto personal terminal
  • Working keyboard
  • Basic ability to follow directions

Basic Git Workflow

  1. mkdir <folder_name> creates a folder on your terminal
  2. touch <filename.txt> creates a text file within your folder
  3. git init tells git to begin watching your new folder of files
  4. git commit -m 'Initial commit' Git begins tracking your folder and all its contents
  5. atom <filename.txt> to edit the text file in atom
  6. add <filename.txt> adds the new version of the file to the staging area
  7. git commit -m 'Version two with detail' sends the new version to the final respository with a detailed message of what changed
  8. git push how you send the working repository to Github to be shared and enjoyed by all

Example

virginialadd~/git_homework[master !?+]$ touch example_one.txt
virginialadd~/git_homework[master !?+]$ git init
Reinitialized existing Git repository in /Users/virginialadd/git_homework/.git/
virginialadd~/git_homework[master !?+]$ git commit -m"Initial commit"
[master 4681ae2] Initial commit
 1 file changed, 1 insertion(+)
 create mode 160000 best_animals
virginialadd~/git_homework[master !?*]$ atom example_one.txt
virginialadd~/git_homework[master !?*]$ git add example_one.txt
virginialadd~/git_homework[master !?+*]$ 

The Three Working Levels of Git

Modified / Working

The first level where edits are made

You modify files in your working tree

Staged

The second level where you double check your work, and certify that it is ready as is

You selectively stage just those chanegs you want to be part of your next commit, which adds only those changes to the staging area

Committed

The final level where all the finished work is stored

You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory

alt text

Maxx A Support Animal to help you on your Journey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment