Git Cheat Sheet Page 2

ADVERTISEMENT

+
Additional Options
git config
git diff
git config --global
Show difference between working directory and last commit.
Define the author name to be used for all commits by the current user.
git diff HEAD
user.name <name>
git config --global
Define the author email to be used for all commits by the current user.
git diff --cached
Show difference between staged changes and last commit.
user.email <email>
git config --global
Create shortcut for a Git command. E.g. alias.glog "log --graph
git reset
alias.<alias-name>
--oneline" will set "git glog" equivalent to "git log --graph --oneline"
<git-command>
git config --system
Set text editor used by commands for all users on the machine. <editor>
Reset staging area to match most recent commit, but leave the working
git reset
core.editor
arg should be the command that launches the desired editor (e.g., vi).
directory unchanged.
<editor>
Reset staging area and working directory to match most recent commit
git config --global
Open the global configuration file in a text editor for manual editing.
git reset
--hard
--edit
and overwrites all changes in the working directory.
Move the current branch tip backward to <commit>, reset the staging
git log
git reset <commit>
area to match, but leave the working directory alone.
Same as previous, but resets both the staging area & working directory to
Limit number of commits by <limit> . E.g. "git log -5" will limit to 5
git reset
--hard
git log -<limit>
<commit>
match. Deletes uncommitted changes, and all commits after <commit>.
commits
git rebase
git log --oneline
Condense each commit to a single line.
Interactively rebase current branch onto <base>. Launches editor to enter
Include which files were altered and the relative number of lines that
git rebase -i
git log --stat
commands for how each commit will be transferred to the new base.
were added or deleted from each of them.
<base>
git pull
git log -p
Display the full diff of each commit.
git log
Fetch the remote’s copy of current branch and rebases it into the local
git pull --rebase
Search for commits by a particular author.
--author="<pattern>"
copy. Uses git rebase instead of merge to integrate the branches.
<remote>
git log
Search for commits with a commit message that matches
git push
--grep="<pattern>"
<pattern>.
git log
Show commits that occur between <since> and <until>. Args can be a
Forces the git push even if it results in a non-fast-forward merge. Do not
git push <remote>
<since>..<until>
commit ID, branch name, HEAD, or any other kind of revision reference.
use the
--force
flag unless you’re absolutely sure you know what you’re doing.
--force
git push <remote>
git log -- <file>
Push all of your local branches to the specified remote.
Only display commits that have the specified file.
--all
git log --graph
Tags aren’t automatically pushed when you push a branch or use the
--graph flag draws a text based graph of commits on left side of commit
git push <remote>
--decorate
--tags
--all flag. The --tags flag sends all of your local tags to the remote repo.
msgs. --decorate adds names of branches or tags of commits shown.
page 2
Visit
for more information, training, and tutorials

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2