GIT Intro


Intro to Git

Version control to track a history as you progress in the development of your project

There are 4 Stages to the git environment

  1. The local environment
  2. The staging area
  3. The local repo
  4. The remote repo

Commands

user - the user that is associated with Git

repo - is the repository that holds the project

git init - Initialize a new repo

git clone - clones an existing repo naming the local folder the same as the remote repo

git status - displays a message with whether or not anything has been tracked

git add * - will add all files and directories to the staging area

git commit -m "Write a commit message here" - commits all the staged files to the local repo

log - displays a message with all the recent changes

git stash - if you have made changes that have not been commited, you can stash the changes and change commits (checkout)

git stash pop - will commit the changes that were stashed

git push - will push the changes that have been commited to the local repo to the remote repo

git diff - displays a report highlighting the differences between the local files and whichever commit you have checked out

git pull - will download all the files from the remote repo


Commit Messages

Write descriptive messages so that anyone can track where a bug may have appeared

Commit often, and in chunks that make sense together:

  • Aesthetic changes
  • Database access
  • etc.

This makes it easier to track bugs as there is no need to search through aesthetic changes for problems with database access


.gitignore

A text file that tells Git which files/directories to ignore

Best practice to ignore any file that is generated from other files

  • .css generated from .scss
  • cache files for displaying thumbnails
  • etc.

README.md

Link to GitHub's site

Supply a description of your project so that you or others may know what the hell it is (or is supposed to be)

Is displayed very prominently on GitHub's site - just below the list of files

Written in markdown (.md) which allows for a fair bit of flexibility in formatting

  • How to install
  • How to configure
  • What the dependencies are
  • Status of the project
  • Link to license file