Skip to content

Instantly share code, notes, and snippets.

@outoftime
Last active August 29, 2015 14:07
Show Gist options
  • Save outoftime/772fa49a8555f0c786c9 to your computer and use it in GitHub Desktop.
Save outoftime/772fa49a8555f0c786c9 to your computer and use it in GitHub Desktop.
Dotmatrix cheat sheet

Command line

General-purpose

hcd DIR Go to DIR in your $HASHROCKET_DIR
ll List contents of directory in long format

Rails

sc Start a local Rails console
ss Start a local Rails server
sdbc Start a local Rails database console

Git

Branches
gco BRANCH
git co BRANCH
Check out BRANCH
gb
git br
Alias for git branch
gco . Save a snapshot commit of the working directory, then revert to the latest commit
git snapshot Save a snapshot of the current changes as a stash
gcr BRANCH Check out remote-tracking branch BRANCH into local branch of the same name
git rmbranch BRANCH Delete BRANCH both locally and from remote
gl Alias for git pull
gp
git put
Alias for git push
Staging commits
gst
git st
Alias for git status
gap Add working tree changes to the index interactively
gnap Add working tree changes, including new files, to the index interactively
git aa Stage all working tree changes for commit
git ci Commit the current index
gc Commit the current index, displaying the unified diff in the message template
gca Commit all changes in the index and working tree, displaying the unified diff
gd Show the diff between the working tree and the most recent commit
gdc Show the diff between the index and the most recent commit
gdh Show the overall diff with the most recent commit, both staged and unstaged
History
glp View the commit log with diffs
glg
git tree
View all commits in all branches as a tree
git tr View current branch commit history as a tree
git ln Show a concise, colorized commit history
glod Show a concise, colorized commit history including branch names
Rebasing
gr Alias for git rebase
git ri Perform an interactive rebase
grc Continue a rebase after editing or fixing a commit
gra Abort a rebase
git squash COMMIT Commit the current changes as a squash for commit COMMIT, applied at next rebase
git fixup COMMIT Commit the current changes as a fixup for commit COMMIT, applied at next rebase
gpr Rebase the local branch off of the tracked remote branch
git doff Roll back the last commit into the working tree
reset-authors Set yourself as the author of the most recent commit
Unsorted
git cp Alias for git cherry-pick
gcl Remove all untracked files from the directory
git unpushed Show local commits not pushed to the remote
git unpulled Show remote commits not pulled to local branch
pruneremote Remove local copies of remote branches that no longer exist on the remote

Vim

Git
:Git COMMANDRun arbitrary git command COMMAND
:GstatusGit status in the preview window
:GcommitCommit the contents of the index
:Gmerge BRANCHMerge BRANCH into the current branch and load merge conflicts into quickfix
:Gpull [REMOTE] [BRANCH]Pull BRANCH from REMOTE and load merge conflicts into quickfix
:Gpush [REMOTE] [BRANCH]Push to BRANCH on REMOTE
:Gfetch [REMOTE]Fetch from REMOTE
:Ggrep PATTERN [PATH, ...]
:Glgrep PATTERN [PATH, ...]
Recursively search for a pattern in all files known to git
:Glog
:Gllog
Load all previous revisions of the current file into quickfix/location list
:{range}GlogLoad all previous revisions of the given range in the current file into quickfix
:Gdiff
:Gvdiff
:Ghdiff
Display a vimdiff of the working tree changes to the current file
:Gmove DESTINATIONRename the current file to DESTINATION in git
:GremoveRemove the current file and close the vim buffer
:GblameShow last committer to touch each line
:GbrowseOpen the current file on GitHub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment