Skip to content

Instantly share code, notes, and snippets.

@NonLogicalDev
Last active October 12, 2016 23:39
Show Gist options
  • Select an option

  • Save NonLogicalDev/049b7ad4f379137b6819b03421866515 to your computer and use it in GitHub Desktop.

Select an option

Save NonLogicalDev/049b7ad4f379137b6819b03421866515 to your computer and use it in GitHub Desktop.
Make Git Great Again

Here is my Git Setup that makes working with git a lot more efficient and less annoying.

Share Short Link

# vim: ft=gitconfig
[include]
path = ~/.gitconfig_local
[alias]
# Various shorthands for common commands
cc = commit
cm = commit -m
cca = commit --amend -C HEAD
cp = cherry-pick
ffo = merge --ff-only
rb = rebase
rbu = !git rebase $(git upstream)
b = branch
st = status
co = checkout
## Overrides(optional):
# This overrides the pull command and makes it fool proof safe,
# it will not attempt to do anything smart, no merging, no rebasing.
# it will only work if yo do not have new commits on a branch past the
# last update. This forces you to be more explicit if you want to make non-safe changes.
# i.e instead of:
# git pull
# you will need to do:
# git fetch
# git merge origin/<branch> or git rebase origin/<branch>
# This is more manual but much more safe and packs much less nasty surprises.
#
#pull = pull --ff-only
## Logging:
# Subsitute for default ugly gigantic paged log
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 10
# This command shows which commits are differend between this and another branch
# Ex: git lgd some_feature_branch
lgd = !git lg -n 100 HEAD..
# This command shows which commits are different from the fetched upstream branch
lgdu = !git lg -n 100 HEAD..$(git upstream)
## Tracking:
# This set of commands lets you temporarily stop tracking files
# git will stop paying attention to them basically
untrack = update-index --assume-unchanged
track = update-index --no-assume-unchanged
# This command lists currently untracked files
untracked = !git ls-files -v | grep "^[[:lower:]]" | perl -pe "s/^\\\\w+\\\\s+//"
## Utilities:
# This command shows you the upstream remote branch your current branch is tracking
upstream = !git rev-parse --abbrev-ref $(git symbolic-ref --short HEAD)@{upstream}
[pager]
lg = false
lg = false
[push]
default = simple
[merge]
ff = only
tool = vimdiff
conflictstyle = diff3
[diff]
tool = vimdiff
algorithm = patience
[core]
excludesfile = ~/.gitignore_global
# vim: ft=gitconfig
[user]
name = <name you want to use on this computer>
email = <email>
# vim: ft=gitignore
### Vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
### OSX ###
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment