// Pulling remote (equivilant of $ git pull)
$ git fetch
$ git merge
// Check whats due for checking in
$ git status
// Check in
$ git add <files>
$ git commit (#optional -m "message here")
$ git push
// create a new branch
$ git branch <name_of_branch>
//Create and change to new branch:
$ git checkout -b branchname
//push local branch to remote
$ git push --set-upstream origin <name_of_branch>
// reject all changes in local master
$ git reset --hard
//reset from head
$ git checkout <file>
or
$ git reset -- <file>
$ git reset -- <folder>/*
//Staging files
$ git add -A //stages All
$ git add . //stages new and modified, without deleted
$ git add -u //stages modified and deleted, without new
//get remote branch to local
$ git fetch
$ git checkout <branch_name>
//delete branches
$ git branch -d branch_name // delete branch that is merged in HEAD from local
$ git branch -D branch_name // force delete branch from local
$ git push <remote_name> --delete <branch_name> // delete from remote
// retrieve all commits on a specific line
$ git log -L 155,155:git-web--browse.sh
// create ssh key for github
$ ssh-keygen
// change git url
$ git remote set-url origin git://new.url.here
// --all will fetch all the remotes.
// --tags will fetch all tags as well
$ git fetch --all --tags --prune
//Then check out the tag by running
$ git checkout tags/<tag_name> -b <branch_name>
//If you are on the branch you want to rename
$ git branch -m new-name
//If you are on a different branch
$ git branch -m old-name new-name
//delete all local branches except for master
$ git branch | grep -v "master" | xargs git branch -D
# undo/ignore all permission changes on folders
$ git diff --summary | grep --color 'mode change 100755 => 100644' | cut -d' ' -f7- | xargs -d'\n' chmod +x
$ git diff --summary | grep --color 'mode change 100644 => 100755' | cut -d' ' -f7- | xargs -d'\n' chmod -x
//use kdiff on file from 2 branches compare
$ git difftool mybranch master -- myfile.cs
# reset single file
$ git checkout HEAD -- my-file.txt