-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
99 lines (82 loc) · 5.98 KB
/
.gitconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
[user]
name = Sergio Ruiz
email = serginator@gmail.com
[core]
editor = vim
excludesfile = ~/.gitignore
[submodule]
fetchJobs = 4
[merge]
tool = diff
[diff]
compactionHeuristic = true
[alias]
add = add -u
co = checkout
st = status
ci = commit
br = branch
root = !pwd
visual = !gitk &i
uncommit = reset --soft HEAD^
unstage = reset HEAD --
prunebr = remote prune origin ; Removes local branches that dont't exist remotely
sh = stash
unsh = stash pop
lg = "log --graph --pretty=format:'%Cred%h%Creset - %C(bold blue)<%an>%Creset %C(yellow)%d%Creset %s %Cgreen(%cr)' --abbrev-commit --date=relative"
logfile = "! f() { git log --follow -p $1; }; f"
back = checkout -
update = "! git pull origin `git rev-parse --abbrev-ref HEAD`"
commits-since = "! f() { SINCE=\"yesterday\"; test $# -ne 0 && SINCE=$@; echo \"... commits since $SINCE\"; git log --pretty='%C(bold blue)<%an>%Creset - %s' --after=\"@{$SINCE}\"; }; f"
alias = "! f() { case $# in 0) git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort | awk -F= '{printf \"\\033[1;34m\" $1 \"\\033[0m \" \"=\";$1=\"\"; print $0}' ;; 1) git alias | grep -e \"$1\" ;; *) git config --global \"alias.$1\" \"$2\" ;; esac; }; f"
undo = "! f() { back=\"^\"; case \"$1\" in -h|--hard) test $2 -gt 1 > /dev/null 2>&1 && back=\"~$2\" git reset --hard HEAD$back && exit 0;;; -s|--soft) test $2 -gt 1 > /dev/null 2>&1 && back=\"~$2\";;*) test $1 -gt 1 > /dev/null 2>&1 && back=\"~$1\";;esac; git reset --soft HEAD$back; git reset }; f"
local-commits = "! f() { ref=$(git symbolic-ref HEAD); branch=${ref#refs/heads/}; git log --pretty='%C(bold blue)<%an>%Creset - %s' origin/${branch}..${branch} $*; }; f"
track = "! git for-each-ref --format=\"%(refname:short) <- %(upstream:short)\" refs/heads | awk -F \"<-\" '{ printf $1 \"\\033[1;34m\" \"<- \"; if ($2 == \" \") printf \"\\033[1;31m(No tracking branch)\"; else printf $2; print \"\\033[0m\"}'"
revertacommit = reset --hard HEAD~1
desc = "! f() { git stash --quiet --include-untracked;BRANCH=\"master\";if [ -n \"$1\" ]; then BRANCH=\"$1\"; fi;git checkout \"$BRANCH\" --quiet;git pull --quiet origin \"$BRANCH\";git describe;git checkout - --quiet;git stash pop --quiet; }; f"
listmergedbranches = "! git branch -r --merged | grep -v '\\*\\|master\\|develop\\|release' | sed 's/origin\\///'"
removemergedbranches = "listmergedbranches | xargs -n 1 git push --delete origin; git fetch origin --prune"
removelocalmergedbranches = "! git branch -l --merged | grep -v '\\*\\|master\\|develop\\|release' | xargs -n 1 git branch -d"
whodidthat="! f() { LINE=$1 FILE=$2 REVS=$3; for commit in $(git rev-list -n $REVS HEAD $FILE); do git blame -n -L$LINE,+1 $commit -- $FILE; done; }; f" ;git whodidthat 7 file.txt 3 ----> return 3 revs of who touched line 7 in file.txt
search="! f() { git lg -i --grep=$1; }; f"
resettags="! f() { git tag -d $(git tag) && git fetch --tags; }; f"
# (review this) tar="! f() { BR=`git rev-parse --abbrev-ref HEAD`; OUT=`echo $BR | sed -E 's/\//--/'`; git archive $BR --format=tar --output=$OUT.tar; }; f"
; usage: git cim "My commit message" <other commit params>
cim ="! f() { JIRA_PROJECT=`cat .jira-project`; MESSAGE=\"$1\"; shift; BRANCH=`git rev-parse --abbrev-ref HEAD`; if [ -n \"$JIRA_PROJECT\" ]; then ISSUE=`echo \"$BRANCH\" | grep -E \"$JIRA_PROJECT-[\\d]*\" | cut -d \"-\" -f 2`; fi; if [ -n \"${ISSUE}\" ]; then MESSAGE=\"$JIRA_PROJECT-$ISSUE $MESSAGE\"; fi; git commit -m\"$MESSAGE\" $@; }; f"
new-cim ="! f() { MESSAGE=\"$1\"; shift; BRANCH=`git rev-parse --abbrev-ref HEAD`; JIRA_PROJECT=`echo \"$BRANCH\" | grep -Eo \"\\/(\\w+)\" | grep -Eo \"[^\\/]+\"`; if [ -n \"$JIRA_PROJECT\" ]; then ISSUE=`echo \"$BRANCH\" | grep -E \"$JIRA_PROJECT-[\\d]*\" | cut -d \"-\" -f 2`; fi; if [ -n \"${ISSUE}\" ]; then MESSAGE=\"$JIRA_PROJECT-$ISSUE $MESSAGE\"; fi; git commit -m\"$MESSAGE\" $@; }; f"
dev = "! git checkout master; git pull origin master"
; usage: git new-branch feature 1234 short-desc // feature/TVAPPS-1234-short-desc
; usage: git new-branch feature short-desc // feature/short-desc
new-branch = "! f() { TYPE=\"$1\"; shift; BRANCH=$TYPE/`git branch-name $@`; git co -b $BRANCH; git push origin $BRANCH; }; f"
; usage: git feature 1234 short-desc or git feature short-desc
feature = "! f() { git dev; git new-branch feature $@; }; f"
bug = "! f() { git dev; git new-branch bug $@; }; f"
subbug = "! f() { git update; git new-branch bug $@; }; f"
task = "! f() { git dev; git new-branch task $@; }; f"
subtask = "! f() { git update; git new-branch task $@; }; f"
hardening = "! f() { git dev; git new-branch hardening $@; }; f"
delbranch = "! f() { git dev; git br -d $1; git push origin :$1; }; f"
renamebranch = "! f() { git branch -m $1 $2; git push origin :$1; git push --set-upstream origin $2; }; f"
mergedev = "! git dev; git checkout -; git update; git merge master"
save-work = "! f() { path=`git rev-parse --show-toplevel`;repo=`basename $path`;mkdir -p ~/Dropbox/git-work/$repo;git diff > ~/Dropbox/git-work/$repo/last-day;echo `git rev-parse --abbrev-ref HEAD` > ~/Dropbox/git-work/$repo/branch-name; }; f"
restart-work = "! f() { path=`git rev-parse --show-toplevel`;repo=`basename $path`;git co master;git pull;git co `cat ~/Dropbox/git-work/$repo/branch-name`;git update;git apply ~/Dropbox/git-work/$repo/last-day; }; f"
; Aux alias (used by other alias)
branch-name = "! f() { BRANCH=\"$1\"; if [ -n \"${2}\" ]; then BRANCH=\"TVAPPS-$1-$2\"; fi; echo $BRANCH; }; f"
srs30 = !git config user.name "Sergio Ruiz" && git config user.email sergio.ruiz@aurigae.com
serginator = !git config user.name "Sergio Ruiz" && git config user.email serginator@gmail.com
#[url "http://github.com/"]
# insteadOf = "gh:"
#[url "git@github.com:"]
# insteadOf = "https://github.com/"
# insteadOf = "http://github.com/"
# insteadOf = "gh:"
#[url "git@github.com:serginator/"]
# insteadOf = "gs:"
#[url "http://github.com/serginator/"]
# insteadOf = "gs:"
[push]
default = current
[color]
ui = true
[hub]
host = github.com