Categories
Internet Other

Git command line shortcuts

Here a short cheat sheet of common commands I use with git/github:

#To stage any modified file, including deleted ones.
git add -u

#stage all new files
git add .
#or
git add --all

# Commit any local change in tracked files
git commit -a -m 'message'

#Reverse a commit
git commit --ammend

#checkout branch and create it if doesn't exists
git checkout -b 2.0 origin/2.0

#To ignore changes in a file, perfect for config files
git update-index --assume-unchanged FILENAME

#git ignore example .gitignore
oc/cache/*
oc/logs/*
images/*