Git commands

, 13/04/2018

Init empty repository

git init

Show git status ( current branch, files modified )

git status

Add all files

git add .

Add selected files

git add [filename.js]

Commit changes

git commit -m "initial commit"

Get content from the distant repo

git pull origin [branch name - ex : master]

Push content to the distant repo

git push origin [branch-name - ex : master]

Clone branch to local repo

git remote add origin [branch-name] -q

Display files changes

git diff head

Remove last commit

git checkout .

Switch to a branch

git checkout [branch-name]

Create a new branch

git checkout -b [branch-name]