Skip to content

Instantly share code, notes, and snippets.

@juaniyyoo
Created November 20, 2014 15:04
Show Gist options
  • Save juaniyyoo/655c71b535e90719e35c to your computer and use it in GitHub Desktop.
Save juaniyyoo/655c71b535e90719e35c to your computer and use it in GitHub Desktop.
Git CheatSheet
# Git
## Configuration
git config --global user.name "<Mon Nom>" : Configure the user name
git config --global user.email "<Mon Emaill>" : Configure the user email
git config --global core.editor vim : Configure VIM as the default editor
git config --global core.autocrlf input : Configure automatic conversion of CRLF to LF
git remote add <name> <repository> : Add a remote repository
git remote remove <name> : Remove a remote repository
## Utilisation
git init : Initialize the direcotry as a git repository
git log : Display commit history
git log --pretty=oneline : Pretty display, one line per commit
git status : Display the repository state
git add <files> : Add files to be committed
git rm <files> : Remove files from repository
git commit -m "<message>" : Commit the staged files
git reset HEAD~ : Return repository to the level HEAD - 1
git reset HEAD~1 : Return repository to the level HEAD - 2
git reset <commit hash> : Return repository to the <commit hash> level
git revert <commit hash> : Remove a commit (add a commit removing the delta of the commit)
git checkout <file> : Return file to the repository HEAD state
git rebase -i HEAD~3 : Rewrite the 4 last commits to rearrange them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment