git init |
Creates an empty git repository |
git config --global user.name "Your userName" |
Defines author names for commits |
git config --global user.email "Your email" |
Defines author email for commits |
git add |
Add files to staging area |
git commit -m "message" |
Commit the staged snapshot with message |
git status |
List which files are staged/unstaged/untracked |
git log |
Display commit history |
git diff |
Shows unstaged changes |
git diff --cached |
Shows staged changes |
git commit --amend -m |
Replaces last commit with staged & previous changes |
git remote add |
Create a connection between remote and local repo |
git push |
Push the changes to remote |
git clone |
Clone into local machine from remote repo |
git pull |
Pull the changes from remote |
git checkout -b "branchName" |
Create and checkout to new branch |
git branch |
Get list of branches |
git reset --hard |
Delete all changes after the commit |
git reset --soft |
Deletes the commit after commit but keeps changes |