git init | Initializes a git repository within the current directory/folder
touch <filename> | Creates a new file within the current directory/folder
code . | Opens files in Visual Studio Code
git status | Checks the status of all staged files. Changes can be tracked or untracked
git add <filename> | Adds a single file to the staging area
git add . | Adds all files to the staging area
git rm --cached <filename> |
ls | Lists the contents of the current directory/folder
git commit -m <descriptive msg> | Commits all files in the staging area, with a short descriptive message describing the commit
git log | Shows commit history
git log --oneline | Summarizes commit history
git checkout <commitID> |
git checkout master | Takes you back to the master branch
git revert <commitID> | Reverts back to a point in time, given the unique commit ID
VIM: shift+: --> wq |
git reset <commitID> --hard | Hard resets a commit, given it's unique ID
git branch <branchname> | Creates a new branch
git branch -a | Displays all branches
git branch -d <branchname> |
git branch -D <branchname> |
git checkout -b <branchname> | Creates a new branch and takes you there
git merge <branchname> | Merges a certain branch with the master branch. Make sure you are in the master branch at the time you merge.
git commit | Only used after fixing a conflict
git clone <reposURL> | Clones a remote repository, using the URL to that repository
git remote add <reposURL> origin |
git push origin master | Pushes to the master branch on the remote location
git pull origin master | Pulls from the master branch on the remote location
git fetch |