aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Hovorka <[email protected]>2019-12-28 17:24:23 -0700
committerAdam Hovorka <[email protected]>2019-12-28 17:24:23 -0700
commit84e2045d54eca681558a783d379d2327c2f1b23c (patch)
treeeac96ed69d7e0e6981df1be8acd61209675319f9
parent5894305ef83de218c833e5a265fbc53d7733b8a2 (diff)
Add ~/.gitconfig
-rw-r--r--base.yaml1
-rw-r--r--base/gitconfig115
-rw-r--r--base/zsh/aliases.zsh6
3 files changed, 119 insertions, 3 deletions
diff --git a/base.yaml b/base.yaml
index 8a17ade..8576447 100644
--- a/base.yaml
+++ b/base.yaml
@@ -19,6 +19,7 @@
~/.bin/tldr: base/tldr
~/.capsesc: base/capsesc
~/.curlrc: base/curlrc
+ ~/.gitconfig: base/gitconfig
~/.makepkg.conf: base/makepkg.conf
~/.npmrc: base/npmrc
~/.tmux.conf: base/tmux.conf
diff --git a/base/gitconfig b/base/gitconfig
new file mode 100644
index 0000000..1221589
--- /dev/null
+++ b/base/gitconfig
@@ -0,0 +1,115 @@
+[user]
+ name = Adam Hovorka
+ #signingkey =
+[github]
+ user = adamhovorka
+[url "https://github.com/"]
+ insteadOf = gh:
+[url "https://gist.github.com/"]
+ insteadOf = gist:
+[url "https://gitlab.com/"]
+ insteadOf = gl:
+[url "https://bitbucket.org/"]
+ insteadOf = bb:
+[url "git.ahov.co:"]
+ insteadOf = ahov:
+
+[core]
+ editor = vim
+ excludesfile = ~/.gitignore_global
+[credential]
+ helper = cache --timeout 3600
+[merge]
+ tool = vimdiff
+[push]
+ default = simple
+#[pull]
+# ff = only
+#[rerere]
+# enabled = 1
+# autoupdate = 1
+#[status]
+# submoduleSummary = true
+
+[color]
+ ui = true
+[color "branch"]
+ current = yellow reverse
+ local = green
+ remote = red
+[color "diff"]
+ meta = black bold
+ frag = magenta
+ old = red
+ plain = white
+ new = green
+ whitespaces = red reverse
+[color "status"]
+ added = green
+ changed = yellow
+ untracked = red
+
+[alias]
+ this = !bash -c 'git root &>/dev/null && echo "Already a git repository" || (git init && git add . && git commit -m \"Initial commit\")'
+ root = rev-parse --show-toplevel
+ cloner = clone --recursive
+ rv = remote -v
+
+ h = "!f() { git log $* | grep '^commit ' | cut -d' ' -f2; }; f" # Return a list of commit SHA1s
+ details = log -n1 -p --format=fuller # View the log and diff for a commit (previous if no SHA1 provided)
+ churn = !git log --all -M -C --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN {print "count,file"} {print $1 "," $2}'
+ l = log --graph --topo-order --boundary --date=short --pretty='%>|(14) %C(1)%h%Creset %C(2)%cd%Creset %<(20)%C(4)%an%Creset │ %s%C(16)%d%Creset'
+ la = !git l --all
+ ll = log --decorate --stat
+ lp = log --patch
+ d = diff # Current vs added
+ dc = diff --cached # Added vs committed
+
+ b = checkout -b
+ co = checkout
+ com = checkout master
+ pullr = pull --rebase
+ ra = rebase --abort
+ rc = rebase --continue
+ squash = rebase -i
+ br = branch -a
+ bv = branch -av
+ bd = branch -d
+
+ fetchp = fetch --prune
+ fetcha = fetch --all
+ mergef = merge --ff-only
+
+ s = stash # --keep-index || -u [-a] || --patch (interactive)
+ sl = stash list
+ sp = stash push
+ sd = stash drop
+ sa = stash apply
+ sb = stash branch
+ poop = stash pop
+
+ rmd = !git ls-files -z --deleted | xargs -0 git rm # Remove deleted files
+ addremove = !git rmd && git add . --all # Add and remove all changes
+ hard = reset --hard origin/master
+ unstage = reset HEAD --
+
+ pushallmaster = !git remote | xargs -L1 -I REMOTE git push REMOTE master
+ pushm = !git pushallmaster
+ pushf = push --force-with-lease # safe force pushing
+ pushfm = !git pushm --force-with-lease
+
+ export = archive -o latest.tar.gz -9 --prefix=latest/ # Save a repo as a tarball; git export master
+ amend = !git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend # Same message, but include more added files
+ trim = !git reflog expire --expire=now --all && git gc --prune=now # Thin out older metadata, reduce filesystem footprint
+
+ spull = !git pull && git submodule sync --recursive && git submodule update --init --recursive
+ sspull= !git pull && git submodule update --init --recursive --remote
+ sfetch = submodule foreach 'git fetch --all'
+
+ brlocaloneline = !git branch | grep -v \\* | xargs
+ brdeletelocal = !git branch -D `git brlocaloneline` || echo "Nothing to delete"
+ brallfromremotes = !git branch -a | grep 'remotes/' | grep -v "HEAD" | sed 's/remotes\\///'
+ brcreatefromremotes = !git brallfromremotes | xargs git branch
+ sync = !git checkout master && git brdeletelocal && git fetch --all
+ # https://stackoverflow.com/questions/10610327/delete-all-local-git-branches#10610669
diff --git a/base/zsh/aliases.zsh b/base/zsh/aliases.zsh
index 0efcbd9..ccca0b2 100644
--- a/base/zsh/aliases.zsh
+++ b/base/zsh/aliases.zsh
@@ -35,10 +35,10 @@ alias mv="mv -i"
# GIT
alias gits='git status --short'
-alias gp='git push'
+#alias gp='git push'
alias gl='git pull'
-alias ga='git add'
-alias gco='git checkout'
+#alias ga='git add'
+#alias gco='git checkout'
alias gwc='git whatchanged -p --abbrev-commit --pretty=medium'
# POWER