Set your name and email:
$ git config --global core.name "Me"
$ git config --global core.email "me@company.com">
Display your config
$ git config --global
$ git config --local # in a repository
Stage your changes:
# Add to index / stage
$ git add file.txt
# Add all modified and new files (tracked or not) to index
$ git add -A
# Partial staging
$ git add -p file.txt
Create a commit into the current branch:
# Commit from index
$ git commit
# Commit from tracked file list
$ git commit file1.txt file2.txt
# All modified tracked files
$ git commit -a
# Commit from pattern
$ git commit **/*.py
See the current status:
$ git status
# Log integral
$ git log
# 5 dernier commits
$ git log -5
# Diff between two branches
$ git log origin/master..master
$ git branch feature # Create the branch
$ git checkout feature # Switch to the new branch
# or in a single command
$ git checkout -b feature
Branches diverge when they have different commits
Create a merge commit and keep your branch history:
$ git merge feature
Re-apply your commits and keeps your history linear:
$ git rebase master
# or interactive version
$ git rebase -i master