cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <div class="container">
  <h1>Git Cheatsheet</h1>
<p class="note">Note: Items contained in [] are optional. All caps words should be replaced, except HEAD.</p>
<ul class="sheet">
    <h3>Just installed Git?</h3>
    <pre class="prettyprint lang-git">git config --global user.name "Your Name"
git config --global user.email "your@email.com"
git config --global color.ui true
git config --global core.autocrlf true</pre>
    <pre class="prettyprint lang-git"># From existing data
git init
git add .
git commit -m "Initial commit."
# From existing repo
git clone ~/existing ~/new
git clone https://USER@HOST.COM/PROJECT.git</pre>
    <pre class="prettyprint lang-git"># View changed files
git status
# View changes
git diff [ID:FILE]
# View changes between commits
git diff ID1 ID2
# View History
git log
# Who did this?
git blame FILE
# View changes between branches
git diff branch1..branch2
# View changed files between branches
git diff --name-status branch1..branch2</pre>
    <pre class="prettyprint lang-git">git fetch [REMOTE BRANCH]
# Fetch and merge
git pull [REMOTE BRANCH]</pre>
    <h3>Local work</h3>
    <pre class="prettyprint lang-git"># Add all changes to stage
git add .
# Commit all tracked files
git commit -a [-m "Initial commit."]
# Commit staged changes
git commit
# Unstage file
git reset FILE</pre>
    <pre class="prettyprint lang-git"># View branches
git branch
# Create branch off current
git branch BRANCH
git checkout -b BRANCH
# Switch between branches
git checkout BRANCH
# Merge branches
git checkout BRANCH2
# Delete local branch
git branch -d BRANCH
# Delete without merging
git branch -D BRANCH
# Delete remote branch
git push REMOTE --delete BRANCH
# Fetch remote branch to local
    <pre class="prettyprint lang-git"># Save a stash
git stash
# View stashes
git stash list
# Apply stash
git stash apply [STASH1]
# Apply and remove
git stash pop
# Clear all stashes
git stash clear</pre>
    <pre class="prettyprint lang-git"># Revert to last commit
git reset --hard HEAD^
# Undo last commit
git reset --soft HEAD^
# Reset file
git checkout -- FILE</pre>
    <pre class="prettyprint lang-git"># Push changes to another repo
git push [REMOTE BRANCH]
# Make a version or milestone
git tag NAME
    <pre class="prettyprint lang-git"># Remove untracked files and directories
git clean -fd
# Check for errors
git fsck</pre>
    <pre class="prettyprint lang-git"># Config format
git config --global alias.co "checkout"

co "checkout"
st "status -sb"
ls "log --pretty=format:'%h: %s'"
df "diff"
ci "commit"
# Usage
git co branch</pre>
    <pre class="prettyprint lang-git"># Archive into a zip file
git archive --format zip --output /full/path/file.zip BRANCH</pre>
<ul class="sheet">
    <h3>Amend commit</h3>
    <pre class="prettyprint lang-git">git commit -m "Initial commit."
git add FILE
git commit --amend</pre>
    <h3>Push to a different remote branch</h3>
    <pre class="prettyprint lang-git">git push REMOTE LOCAL_BRANCH:REMOTE_BRANCH</pre>
    <h3>Access new remote branch</h3>
    <pre class="prettyprint lang-git">git fetch REMOTE REMOTE_BRANCH:LOCAL_BRANCH
git checkout LOCAL_BRANCH</pre>
    <h3>Set upstream</h3>
    <pre class="prettyprint lang-git">git branch --set-upstream BRANCH REMOTE/REMOTE_BRANCH</pre>
    <pre class="prettyprint lang-git"># Untrack file without removing
git rm --cached FILE
# Untrack folder without removing
git rm -r --cached FOLDER/.
    <pre class="prettyprint lang-git"># Ignore file mode changes
git config core.fileMode false
    <h3>Force Overwrite of Local Files</h3>
    <pre class="prettyprint lang-git">git fetch --all
git reset --hard REMOTE/BRANCH
              $text-color: #ddd;
$keyword-color: skyblue;
$string-color: lawngreen;
$comment-color: #999;
$type-color: yellow;

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: "Ubuntu Mono", "Lucida Console", monospace;
  color: $text-color;
  font-size: 14px;

.note {
  font-size: 80%;
  padding: 6px 0px;
  margin: 0;

.container {
  width: 100%;
  padding: 10px;

h1 {
  margin: 0;
  color: lawngreen;

h2 {
  margin: 10px 0px 0px;
  font-size: 140%;
  color: tomato;

h3 {
  margin: 16px 0px 0px;
  font-size: 120%;
  color: orange;
  border-bottom: 1px solid #444;

pre {
  border: 0;
  overflow-x: auto;
  white-space: pre-wrap;

pre .com {
  color: $comment-color;

pre .pln, pre .pun, pre .opn, pre .clo { color:$text-color; }
pre .str { color: $string-color; }
pre .kwd { color:$keyword-color; }
pre .typ { color: $type-color; }
pre .com + .pln { white-space: normal; }
pre.prettyprint { border: 0!important; }
li.L1,li.L3,li.L5,li.L7,li.L9{ background:#3f3f3f!important; }
ol.linenums, li { list-style-type: decimal-leading-zero!important; }

.linenums li {
  border-left: 4px solid #555; 
  padding-left: 10px; 

ul {
  margin: 0;
  padding: 0;
  width: 100%;
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex; 
  -webkit-flex-direction: row;
  flex-direction: row;
  flex-wrap: wrap;
  -webkit-box-pack: flex-start; -moz-box-pack: flex-start; 
  -ms-flex-pack: flex-start; 
  -webkit-justify-content: flex-start;
  justify-content: flex-start;
  -webkit-box-align: flex-start; -moz-box-align: flex-start;
  -ms-flex-align: flex-start;
  -webkit-align-items: flex-start;
  align-items: flex-start;
  list-style-type: none;

ul.sheet > li {
  display: block;
  width: 100%;

@media only screen and (min-width: 800px) {
  body { font-size: 16px; }
  ul.sheet > li { width: 50%; padding: 0 10px; }

@media only screen and (min-width: 1200px) {
  //body { font-size: 24px; }
  ul.sheet > li { width: 33.33%; }
         // Whitespace
         [PR['PR_PLAIN'],       /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
         // A double or single quoted, possibly multi-line, string.
         [PR['PR_STRING'],      /^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/, null,
         // A comment is either a line comment that starts with two dashes, or
         // two dashes preceding a long bracketed block.
         [PR['PR_COMMENT'], /^(?:#[^\r\n]*)/],
          [PR['PR_KEYWORD'], /\b(?:git|list|branch|config|init|clone|status|archive|diff|add|commit|push|pull|stash|remote|apply|pop|reset|clean|fetch|HEAD|clear|tag|checkout|rm|log|blame)\b/, null],
         // An identifier
          [PR['PR_PLAIN'], /^[a-z_][\w-]*/i],
         // A run of punctuation
         [PR['PR_PUNCTUATION'], /^[^\w\t\n\r \xA0\"\'][^\w\t\n\r \xA0+\-\"\']*/]
Loading ..................