Last active
March 8, 2021 21:48
-
-
Save SimonPStevens/2652093 to your computer and use it in GitHub Desktop.
Git Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
autocrlf = false | |
pager = less | |
[push] | |
default = tracking | |
[branch] | |
autosetupmerge = true | |
[color] | |
diff = auto | |
ui = auto | |
[user] | |
name = \"[NAME]\" | |
email = \"[EMAIL]\" | |
[alias] | |
# Fetch, log, status. | |
s = status | |
rf = remote -v update | |
ls = !git lg && echo '' && echo '' && git s | |
fls = !git rf && echo '' && git ls | |
# Log all, log all with no pager, log 5 results, log 10 results, log 20 results, and a log the default number of results (10). | |
lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %C(green)%an%Creset - %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative | |
lganp = !git --no-pager lga | |
lg5 = !git lganp -n 5 | |
lg10 = !git lganp -n 10 | |
lg20 = !git lganp -n 20 | |
lgs5 = !git lg5 --stat | |
lgs10 = !git lg10 --stat | |
lgs20 = !git lg20 --stat | |
lg = !git lg10 | |
lgs = !git lgs5 | |
# Add, add untracked, add all. | |
a = !git add . && git s | |
au = !git add -u && git s | |
aa = !git add . && git add -u && git s | |
# Resetting to head | |
rhs = !git reset HEAD && git s | |
# Commit. | |
c = commit | |
# Diff tool normal head and staged. | |
dt = difftool | |
dth = difftool HEAD | |
dts = difftool --staged | |
# Diff normal, head and staged. | |
d = diff | |
dh = diff HEAD | |
ds = diff --staged | |
# Diff (words) normal, head and staged. | |
dw = diff --color-words | |
dwh = diff HEAD --color-words | |
dws = diff --color-words --staged | |
# List Aliases. | |
la = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\t=> \\2/' | sort | |
# List and delete merge backs (.orig files) | |
list-merge-backups = !git status -su | grep -e'\\.orig$' | cut -f2 -d' ' | |
delete-merge-backups = !git list-merge-backups | xargs rm | |
# Show all commits. | |
show-all = !gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' ) & | |
show-unreachable = !gitk --all $( git fsck --unreachable | awk '/commit/ {print $3}' ) & | |
# Mark as unchanged. | |
mu = update-index --assume-unchanged | |
[merge] | |
tool = kdiff3 | |
conflictstyle = diff3 | |
[mergetool "kdiff3"] | |
path = c:/Program Files (x86)/KDiff3/kdiff3.exe | |
[diff] | |
guitool = kdiff3 | |
[difftool "kdiff3"] | |
path = c:/Program Files (x86)/KDiff3/kdiff3.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This file should be placed in a location that is in %path% | |
# | |
# If you place it in the same folder as the gitex.cmd you can change it to just be this: | |
# "gitex.cmd" "$@" & | |
PFX86="$(env | sed -n 's/^ProgramFiles(x86)=//p')"; | |
"$PFX86\GitExtensions\gitex.cmd" "$@" & | |
# for x64 you can use this simpler version instead: | |
# "$PROGRAMFILES\GitExtensions\gitex.cmd" "$@" & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Wildcards must either be passed escaped, or in quotes | |
# Or do "set -f" before running. | |
# Read about globbing if you have issues with passing wildcards to scripts: | |
# http://blog.edwards-research.com/2011/05/preventing-globbing/ | |
# | |
if [ -z "$1" ]; then | |
printf 'git reset HEAD\ngit s\n\n' | |
git reset HEAD | |
git s | |
else | |
printf 'git reset HEAD %s\ngit s\n\n' "$@" | |
git reset HEAD "$@" | |
git s | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment