GIT Cheat Sheet by Hello, World!
GIT Cheat Sheet by Hello, World!
Minutes
Git is a free and open source Git for All Platforms: List the staged, unstaged &
git status
distributed version control http://git-scm.com untracked files
system designed to handle
everything from small to very Debian/Ubuntu:
List current branch’s commit
large projects with speed and In terminal type, git log
history
efficiency. sudo apt-get install git
Create empty git repository in the specified directory. Run with no Show changes between working
git init <directory>
arguments to initiate the current directory as a git repository.
git diff
directory and staging area
git clone <url> Set the email that will be visible with your commits & tags Add the file to the staging area
for next commit. Use . in place of
git add file to add all changed files from
the current directory to the
staging area.
git diff --cached Show difference between staged changes and last commit. Create a new connection
git remote add <name> <url> to a remote repo
TEMPORARY COMMITS
Push local branch to remote
git push -u <remote> <branch> repo & sets its copy as an
upstream
git stash Put current changes in your working directory into stash for later use.
git stash pop Apply stored stash content into working directory, and clear stash.
git stash drop Delete a specific stash from all your previous stashes.
REWRITE HISTORY
Forces the git push even if it results in a non-fast-forward merge. Do not use Clear staging area, rewrite
git push <remote> --force the --force flag unless you’re absolutely sure you know what you’re doing git reset —hard <commit> working tree from specified
commit.
git push <remote> --all Push all of your local branches to the specified remote.
Tags aren’t automatically pushed when you push a branch or use the --all flag.
git push <remote> --tags
The --tags flag sends all of your local tags to the remote repo
Hello, World!