Skip to content

Instantly share code, notes, and snippets.

@oskopek
Last active August 27, 2015 16:57
Show Gist options
  • Save oskopek/2785c14d1b083f978e5d to your computer and use it in GitHub Desktop.
Save oskopek/2785c14d1b083f978e5d to your computer and use it in GitHub Desktop.
Cheatsheets

Asciidoctor cheatsheet

  • Strikethrough: Strike me!

Git cheatsheet

  • Show merged local branches (into the current branch): git branch --merged

    • Inverse: git branch --no-merged

  • Interactive rebase (really useful, follow instructions after running): git rebase -i (onto_branch)

    • Pushing after a rebase: git push (remote) (to_branch) --force

  • Show remote repositories: git remote -v

  • Show branches in a remote repo: gity remote show (remote)

  • Enforce fast-forward merge: git merge --ff-only

    • Inverse (enforce non-fast-forward): git merge --no-ff

Example .gitconfig

[color]
    diff = auto
    ui = true
[user]
    email = skopekondrej@gmail.com
    name = Ondrej Skopek
[merge]
    tool = meld
[push]
    default = simple
[core]
    autocrlf = input
[alias]
    tree = log --graph --abbrev-commit --decorate --date=relative --all
    treeo = log --graph --oneline --decorate --date=relative --all
    s = status -s
    st = status
    d = diff
    a = add
    cm = commit
    re = rebase
    m = merge
    co = checkout
    f = fetch
    b = branch
    l = log

git_up script

Goal: update master → prepare local repo for rebase against master

#!/bin/bash

cur_branch=`git status | head -n 1 | grep -Eo '[^ ]+$'`

git checkout master
git fetch origin
git fetch upstream
git merge origin/master --ff
git merge upstream/master --ff
git push origin master
git checkout "$cur_branch"
#git rebase -i master

IntelliJ IDEA cheatsheet

  • Open class of name: CTRL+N

    • Open file of name: CTRL+SHIFT+N

  • Zoom font: CTRL+MouseWheel

    • Needs to be enabled: Settings > Editor > General > Change font size (Zoom) with Ctrl + Mouse Wheel

    • Recommended: Settings > Appearance & Behavior > Keymap > Editor Actions > Reset Font Size: Add keyboard shortcut: CTRL+0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment