Github and Website Workshop/git summary

This is a summary of the git commands and concepts discussed at the Github and Website Workshop

Commands

 * git init: tell git you want to use it in this folder (creates a repository)


 * git status: see what the current state of our project is
 * Tip: It's healthy to run git status often. Sometimes things change and you don't notice it.


 * git add filename: Tell git to stage this file


 * git add -­A .: add all ­- where the dot stands for the current directory, so everything in and beneath it is added. The ­-a stands for all and ensures even file deletions are included


 * git reset filename: removes a file from the staging area


 * git commit -m "commit message": commit the staged files (saves a snapshot)


 * git log: Git's journal­ - remembers the changes we've committed in the order we committed them
 * Tip: use git log ­­--summary to see more information for each commit. You can see where new files were added for the first time or where files were deleted. It's a good overview of the project.


 * git remote add alias url</tt>: add a new remote repository of your project to your local computer files


 * git push to from</tt>: tells Git where to put our commits
 * If you put -­u before to, it tells Git to remember the parameters, so that next time we can simply run git push</tt> and Git will know what to do.


 * git pull from to</tt>: check for changes on our GitHub repository and pull down new changes


 * git diff change</tt>: shows the difference between the current state of the files and previous commit
 * if you don't specify a change, the default is HEAD which by default holds most recent commit, so git diff</tt> shows difference from last commit
 * git diff ­­staged</tt> lets you see the changes you just staged


 * git reset file</tt>: unstages the file


 * git checkout ­­ file</tt>: get rid of all the changes since the last commit for the file


 * git clone url</tt>: copy a git repository so you can add to it

Terms

 * Directory: A folder used for storing multiple files.


 * Repository: A directory where git has been initialized to start version controlling your files.


 * Staging Area: A place where we can group files together before we "commit" them to Git.


 * Commit: A "commit" is a snapshot of our repository. This way if we ever need to look back at the changes we've made (or if someone else does), we will see a nice timeline of all changes.


 * Staged: Files are ready to be committed


 * Unstaged: Files with changes that have not been prepared to be committed


 * Untracked: Files aren't tracked by git yet. This usually indicates a newly created file


 * Deleted: File has been deleted and is waiting to be removed from git


 * Remote repositories: versions of your project that are hosted on the Internet or network somewhere