git add <file>
: add the file changes to the commit queuegit add --all
: adds all the changed files (removed, too) to the commit queuegit branch
: displays a list of checked out branches and which is the active branchgit branch -d <branch>
: deletes a local branchgit checkout -b <branch>
: creates a new branch and switches to itgit checkout <branch>
: switches to a different branchgit checkout <file name>
: reverts the file to HEAD, overwriting your changegit checkout -- *
: discard all changes in the working directorygit commit -m "<message>"
: commits the changes, using the specified commit messagegit config --list --show-origin
: list all Git configuration settings and to which configuration they belong (global, system, local, worktree)git diff >a.patch
: saves the current changes to a patch file calleda.patch
git merge <branch>
: merges changes from a different branchgit pull "origin" <branch>
: pulls the changes to the branch from the remote repogit push "origin" <branch>
: pushes the branch changes to the remote repogit reset --hard origin/<branch_name>
: resets the branch, undoing all local changes. The--hard
option changes all the files in your working tree to match the files inorigin/branch
git rm <file name>
: removes the filegit status
: displays the working tree status
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"