document.write("
[user]
name = user_name
email = user_email
[apply]
# Detect whitespace errors when applying a patch
whitespace = fix
[core]
editor = nvim
autocrlf = input
safecrlf = true
[color]
# Use colors in Git commands that are capable of colored output when
# outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.)
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold # line info
old = red # deletions
new = green # additions
[color "status"]
added = yellow
changed = green
untracked = cyan
[merge]
keepBackup = false
tool = p4merge
[mergetool]
prompt = false
[mergetool "p4merge"]
cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
keepTemporaries = false
trustExitCode = false
keepBackup = false
[diff]
tool = p4merge
[difftool]
prompt = false
[difftool "p4merge"]
cmd = p4merge "$LOCAL" "$REMOTE"
keepTemporaries = false
trustExitCode = false
keepBackup = false
[push]
# change to maching for machines with older versions of git 1.x.x
default = simple
[pull]
rebase = true
[commit]
template = ~/.git-commit-template.txt
.gitconfig - Snippet hosted by \"Cacher\"
# Type should be one of the following:
# * feat (new feature)
# * fix (bug fix)
# * docs (changes to documentation)
# * style (formatting, missing semi colons, etc; no code change)
# * refactor (refactoring production code)
# * test (adding missing tests, refactoring tests; no production code change)
# * chore (updating grunt tasks etc; no production code change)
# Scope is just the scope of the change. Something like (admin) or (teacher).
# Subject should use impertivite tone and say what you did.
# The body should go into detail about changes made.
# The footer should contain any JIRA (or other tool) issue references or actions.
# For a full example of how to write a good commit message, check out
# https://github.com/sparkbox/how_to/tree/master/style/git
# ---------------------------------------------------------------------------------
# Jira Issue Processing
# ISSUE_KEY #comment This is a comment
# ISSUE_KEY #done
# ---------------------------------------------------------------------------------
git-commit-template.txt - Snippet hosted by \"Cacher\"
# Make sure you're adding under the [alias] block.
[alias]
st = status
s = status -s -b
a = add
ap = add -p
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
cam = commit -a -m
m = commit --amend --verbose
d = diff
ds = diff --staged
dch = diff --name-status -r
dca = diff --cached
co = checkout
cob = checkout -b
fo = fetch origin
po = push origin
m = merge
mstop = merge --no-commit
mff = merge --no-ff
mffstop = merge --no-ff --no-commit
pi = cherry-pick -x
pigo = cherry-pick --continue
pistop = cherry-pick -x --no-commit
# push all
pushitgood = !echo 'Ah, push it' && git push -u origin --all && echo 'P-push it real good'
# Undo clashes with git-extras
rh = reset --hard
unstage = reset HEAD --
# delete merged branch
cleanmerged = !git branch --merged | grep -v \\"\\\\*\\" | xargs -n 1 git branch -d
# When used without any argument it will print all changes since the last tag (changelog clashes with git-extras)
changes = "!f() { r=${1:-`git describe --tags --abbrev=0`..HEAD}; echo Changelog for $r; git log --reverse --no-merges --format='* %s' $r; }; f"
## Logs ##
##########
# one-line log
l = log --pretty=format:"%C(yellow)%h\\\\ %ad%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]" --decorate --date=short
hist = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
tree = log --oneline --decorate --graph
last = log -1 HEAD
new = !sh -c 'git log $1@{1}..$1@{0} "$@"'
whois = "!sh -c 'git log -i -1 --pretty=\\"format:%an <%ae>\\n\\" --author=\\"$1\\"' -"
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
# list branches sorted by last modified
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
# Git Commit, Add all and Push — in one step.
cap = "!f() { git add .; git commit -m \\"$@\\"; git push; }; f"
# NEW.
new = "!f() { git cap \\"📦 NEW: $@\\"; }; f"
# IMPROVE.
imp = "!f() { git cap \\"👌 IMPROVE: $@\\"; }; f"
# FIX.
fix = "!f() { git cap \\"🐛 FIX: $@\\"; }; f"
# RELEASE.
rlz = "!f() { git cap \\"🚀 RELEASE: $@\\"; }; f"
# DOC.
doc = "!f() { git cap \\"📖 DOC: $@\\"; }; f"
# TEST.
tst = "!f() { git cap \\"✅ TEST: $@\\"; }; f"
git-aliases - Snippet hosted by \"Cacher\"

Git Housekeeping: clean-up outdated branches in local and remote repositories

\n

Local branches

\n

At first, list all local branches:

\n
$ git branch\n
\n

We need to know what branches are already merged in “development” and can be easily removed:

\n
$ git checkout development\n$ git branch --merged\n
\n

Now, remove all outdated branches with:

\n
$ git branch -d old-merged-feature\n
\n

Next, decide what to do with not merged branches:

\n
$ git branch --no-merged\n
\n

If some of them is just abandoned stuff that you don’t need anymore, remove it with “-D” option:

\n
$ git branch -D old-abandoned-feature\n
\n

References to remote branches

\n

After each git pull or git fetch command Git creates references to remote branches in local repository, but doesn’t clean up stale references.\nList referenced remote branches:

\n
$ git branch -r\n
\n

Clean-up outdated references:

\n
$ git remote prune origin\n
\n

Tip

\n

Update repository with (and Git automatically prunes all stale references):

\n
$ git fetch -p\n
\n

Remote branches

\n

Usually, remote repository is a big garbage heap of stale branches, if there is no responsible housekeeping person.\nAfter previous git remote prune origin we should have synched list of remote branches.

\n

At first, we can find branches which are already merged in “development””:

\n
$ git checkout development\n$ git branch -r --merged\n
\n

But this command does not provide much information. What if this branch is merged, but still used for feature development. Would be cool to know last commit date and author.

\n

This magic snippet provides all required information:

\n
$ for branch in `git branch -r --merged | grep -v HEAD`; do echo -e `git show --format="%ci %cr %an" $branch | head -n 1` \\\\t$branch; done | sort -r\n
\n

Now, you can delete own remote branches, and ask other authors to clean-up theirs:

\n
$ git push origin --delete branch-name\n
\n

Similar snippet for not merged branches:

\n
$ for branch in `git branch -r --no-merged | grep -v HEAD`; do echo -e `git show --format="%ci %cr %an" $branch | head -n 1` \\\\t$branch; done | sort -r\n
\n
git-housekeeping.md - Snippet hosted by \"Cacher\"

Git-Flow Cheatsheet

\n

References

\n\n

Initialize a Repository for git-flow

\n
git flow init -d\n
\n

(Omit -d if you want to select values other than the defaults.)

\n

Features

\n

Start a New Feature

\n

This creates a new branch based on develop and switches to it:

\n
git flow feature start FEATURENAME\n
\n

Finish a Feature

\n

This merges the feature into develop, removes the feature branch, and switches to develop:

\n
git flow feature finish FEATURENAME\n
\n

Publish a Feature

\n

Push a feature branch to remote repository:

\n
git flow feature publish FEATURENAME\n
\n

Get a feature published by another user from remote repository:

\n
git flow feature pull origin FEATURENAME\n
\n

Releases

\n

Start a Release

\n

Create release branch from develop:

\n
git flow release start RELEASENAME\n
\n

Publish release branch:

\n
git flow release publish RELEASENAME\n
\n

Create a local tracking branch for a remote release:

\n
git flow release track RELEASENAME\n
\n

Finish a Release

\n

Merge release branch into master, tag it, merge back into develop, and remove the release branch:

\n
git flow release finish RELEASENAME\ngit push --tags\n
\n

Hotfixes

\n

Start a Hotfix

\n

Create hotfix branch from master:

\n
git flow hotfix start VERSIONNAME\n
\n

Create hotfix branch from some other commit:

\n
git flow hotfix start VERSIONNAME BASENAME\n
\n

Finish a Hotfix

\n

Merge hotfix back into develop and master, and tag:

\n
git flow hotfix finish VERSIONNAME
\n
git-flow-cheatsheet.md - Snippet hosted by \"Cacher\"
#!/bin/bash
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\\(.*\\),\\1,')
if [ $protected_branch = $current_branch ]
then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
echo
if echo $REPLY | grep -E '^[Yy]$' > /dev/null
then
exit 0 # push will execute
fi
exit 1 # push will not execute
else
exit 0 # push will execute
fi
Git Hook Prevent pushing to master.sh - Snippet hosted by \"Cacher\"
");