Git is a software that allows you to keep track of changes made to a project over time. Git works by recording the changes you made to a project, storing those changes, then allowing you to reference them as needed.
- A Working Directory where you’ll be doing all the work creating, editing, deleting and organizing files.
- A Staging Area where you’ll list changes you make to the working directory.
- A Repository where Git permanently stores those changes as different versions of the project.
git init -- creates a new Git repository git status -- inspects the contents of the working directory and staging area git add -- adds files from the working directory to the staging area git diff -- shows the difference between the working directory and the staging area git commit -- permanently stores file changes from the staging area in the repository git log -- shows a list of all previous commits git checkout HEAD filename -- discards changes in the working directory git reset HEAD filename -- unstages file changes in the staging area git reset SHA -- can be used to reset to a previous commit in your commit history git branch -- lists all a Git project’s branches git branch branch_name -- creates a new branch git checkout branch_name -- used to switch from one branch to another git merge branch_name -- used to join file changes from one branch to another git branch -d branch_name -- deletes the branch specified git clone -- creates a local copy of a remote git remote -v -- lists a Git project’s remotes git fetch -- fetches work from the remote into the local copy git merge origin/master -- merges origin/master into your local branch git push origin branch_name -- pushes a local branch to the origin remote