Name | Desc |
git add path | Add file or files in directory recursively |
git add path | Stage file for commit |
git apply - < file | Apply patch from stdin |
git archive rev > file | Export snapshot of revision to file |
git archive rev > file --format=[tar|zip] | Specify archive format to use: tar or zip |
git archive rev > file --prefix=dir/ | Nest all files in the snapshot in directory |
git blame [file] | Show file annotated with line modifications |
git branch | List local branches |
git branch -f branch rev | Overwrite existing branch, start from revision |
git clean | Clean unknown files from the working tree |
git clone url | Clone a remote repository into a subdirectory |
git command --help | Show help for a command |
git commit | Commit files that has been staged (with git-add) |
git commit -a | Automatically stage all modified files |
git diff [path] | Show diff of changes in the working tree |
git diff HEAD path | Show diff of stages and unstaged changes |
git fetch [remote] | Fetch changes from a remote repository |
git format-patch from[..to] | Format a patch with log message and diffstat |
git help command | Show help for a command |
git checkout [rev] file | Restore file from current branch or revision |
git checkout [rev] file -f | Overwrite uncommitted local changes |
git checkout branch | Switch working tree to branch |
git checkout branch -b branch | Create branch before switching to it |
git init | Create a repository in the current directory |
git log [from[..to]] | View commit log for a given revision range |
git log [from[..to]] -S'pattern' | Search history for changes matching pattern |
git log [from[..to]] --stat | List diffstat for each revision |
git log [path] | View commit log, optionally for specific path |
git merge branch | Merge changes from branch |
git mv path destination | Move file or directory to new location |
git mv path destination -f | Overwrite existing destination files |
git pull [remote] | Fetch and merge changes from a remote repository |
git push [remote] | Push changes to a remote repository |
git remote | List remote repositories |
git remote add remote url | Add remote to list of tracked repositories |
git reset --hard HEAD^ | Reset the working tree to the last commit |
git reset HEAD path | Unstage file for commit |
git reset --soft HEAD^ | Undo commit & keep changes in the working tree |
git rm path | Remove file or directory from the working tree |
git rm path -f | Force deletion of file(s) from disk |
git status | Show status of the working tree |
git tag name [revision] | Create tag for a given revision |
git tag name [revision] -l [pattern] | List tags, optionally matching pattern |
git tag name [revision] -s | Sign tag with your private key using GPG |