Monday, 2 December 2013

Very short GIT Cheat Sheet

It will surely grow in the future but, for now, this list contains only the most basic commands - creating local repository, working with local repository, pulling and pushing changes from/to remote repository and showing history.

CREATING LOCAL REPOSITORY
$git init      => Create new local repository

WORKING IN LOCAL REPOSITORY
$git status    => Show working tree status
$git diff      => Show changes between commits, commit and working tree and similar
$git add .        => Add all current local changes to the next commit
$git add -p FILE  => Add specific file(s) changes to the next commit
$git commit       => Commit staged changes to the repository
$git commit -a    => Commit all local changes to the repository

WORKING WITH REMOTE 
$git remote show           => Show info about remote
$git remote -v             => List all currently configured remotes
$git remote add REMOTE URL => Add new remote repository
$git pull                  => Download changes from remote and directly merge in HEAD
$git push                  => Push local changes to remote

HISTORY
$git log         => Show all commit logs, starting with newest
$git log -p FILE => Show all commit logs for specific file(s)

No comments: