-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitconfig
More file actions
115 lines (114 loc) · 4.32 KB
/
gitconfig
File metadata and controls
115 lines (114 loc) · 4.32 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
[user]
name = sabeek
email = sabeekpradhan@gmail.com
[core]
editor = vim
excludesfile = ~/.gitignore
pager = delta --paging=always
[delta]
side-by-side = true
line-numbers = true
navigate = true
[interactive]
diffFilter = delta --color-only
[diff]
tool = vimdiff
colorMoved = default
[credential]
helper = cache --timeout=86400
[push]
default = matching
[merge]
tool = vimdiff
conflictstyle = diff3
[fetch]
prune = true
[branch]
autoSetupMerge = always
[alias]
sl = log --oneline --graph
co = checkout
br = branch
st = status -s
create = checkout --track -b
flow = "!f() { \
gitflow $@; \
}; f"
pushf = push --force-with-lease
pushh = push origin HEAD
pushhf = push --force-with-lease origin HEAD
amend = commit --amend -C HEAD
# Rebase the full stack (including ancestors) onto a new branch.
# If two arguments are given, the second argument is dropped
# from the stack (e.g. if it's the branch for a PR that merged
# via a squash merge)
stack-rebase = "!f() { \
if [ \"$#\" -eq 1 ]; then \
echo \"Rebasing stack (all ancestors) onto '$1' from $(git symbolic-ref --short HEAD)\"; \
git rebase --rebase-merges --update-refs \"$1\"; \
elif [ \"$#\" -eq 2 ]; then \
echo \"Rebasing stack onto '$1' and dropping branch '$2' (starting from $(git symbolic-ref --short HEAD))\"; \
git rebase --onto \"$1\" \"$2\" --rebase-merges --update-refs; \
else \
echo \"usage: git stack-rebase <new-base> [dropped-branch]\" >&2; \
exit 1; \
fi; \
}; f"
# Pull and checkout aliases that also update the submodules.
pulls = "!f() { git pull \"$@\" && git submodule update --init --recursive; }; f"
cos = "!f() { git checkout \"$@\" && git submodule update --init --recursive; }; f"
oldest-ancestor = !bash -c 'diff --old-line-format= --new-line-format= <(git rev-list --first-parent \"${1:-master}\") <(git rev-list --first-parent \"${2:-HEAD}\") | head -1' -
pullr = pull --rebase=preserve
refresh = remote update -p
# Prints the name of the currently checked out branch.
curbranch = "!f() { \
git rev-parse --abbrev-ref HEAD | grep -v ^HEAD$ || git rev-parse HEAD; \
}; f"
# Prints the name of the upstream branch.
parent = "!f() { \
git name-rev --name-only $(git rev-parse `git curbranch`@{upstream}); \
}; f"
# Prints the name of the branch upstream to the specified branch.
parent-of = "!f() { \
git name-rev --name-only $(git rev-parse $1@{upstream}); \
}; f"
# Sets the upstream of the currently checked out branch to the specified
# branch.
sup = branch --set-upstream-to
# Sets the upstream of the specified branch to the currently checked out
# branch. This is the inverse of `git sup`.
# NOTE: This fails if the branch matches the parent branch.
adopt = "!f() { \
CUR_BRANCH=`git curbranch`; \
SELECTED_BRANCH=$1; \
SELECTED_PARENT=`git parent-of $1`; \
git branch $1 --set-upstream-to $CUR_BRANCH; \
git rebase -i --onto $CUR_BRANCH $SELECTED_PARENT $SELECTED_BRANCH; \
git branch $SELECTED_BRANCH --set-upstream-to $CUR_BRANCH; \
}; f"
# Does an interactive rebase only for the commits between the parent branch
# and the currently checked out branch. Then sets the upstream of the
# currently checked out branch to the specified branch. After this, the
# currently checked out branch will the new parent's commits plus the commits
# unique to this branch. It will no longer have the old parent's commits
# (unless the old commits are also in the new parent's branch).
transfer-to = "!f() { \
CUR_BRANCH=`git curbranch`; \
ORIGINAL_PARENT=`git parent`; \
NEW_PARENT=$1; \
git rebase -i --onto $NEW_PARENT $ORIGINAL_PARENT $CUR_BRANCH; \
git branch $CUR_BRANCH --set-upstream-to $NEW_PARENT; \
}; f"
# Creates a parallel copy of the branch instead of one tracking the currently
# checked out branch.
copy = "!f() { \
NEW_BRANCH_NAME=$1; \
PARENT_OF_PARENT=$(git parent-of $(git parent)); \
git checkout -b $NEW_BRANCH_NAME; \
git sup $PARENT_OF_PARENT; \
}; f"
diff-parent = "!git diff `git parent`..HEAD $@"
difftool-parent = "!git difftool `git parent`..HEAD $@"
pullc = "!git pull --rebase origin `git curbranch`"
pr-parent = "!git pushh && hub pull-request -b `git parent` -h `git curbranch` $@"
refresh = "!git fetch origin $1:$1"