-
Notifications
You must be signed in to change notification settings - Fork 0
/
GitAliases.ini
115 lines (87 loc) · 4.6 KB
/
GitAliases.ini
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
####################################################################
#Useful aliases for git
#You can use them by modifying your ~/.gitconfig file
#Copy-Paste the following lines, uncomment them and modify
#the path as needed
#[include]
# path = ~/monolith/dev_tools/tweakenv/git/GitAliases.ini
####################################################################
[alias]
#git alias : list all aliases
#useful in order to learn git syntax
alias = "!git config -l | grep alias | cut -c 7-"
current-branch = rev-parse --abbrev-ref HEAD
push-current-branch-set-upstream = !git push origin $(git current-branch)
#outgoing / incoming commits !
# np = no-pager
outgoing = log --pretty=oneline --abbrev-commit --graph @{u}..
incoming = !git fetch && git log --pretty=oneline --abbrev-commit --graph ..@{u}
outgoing-np = !git --no-pager log --pretty=oneline --abbrev-commit --graph @{u}..
incoming-np = !git fetch && git --no-pager log --pretty=oneline --abbrev-commit --graph ..@{u}
#
# Query history
#
#git last : last commit
last = log -1 HEAD
#git compactlog :
compactlog = log --pretty=format:"%h%x09%an%x09%ad%x09%s"
#glog : graphic log (with branches trail)
glog = log --graph --full-history --all --no-prefix --color --pretty=format:\"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%x1b[0m%x20%s%x1b[36m%x20%an%x1b[0m%x20\"
#git ls : List commits in short form, with colors and branch/tag annotations
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
#git ll : List commits showing changed files
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
#git llc : List with no colors if you need to chain the out put with Unix pipes
llc = log --pretty=format:"%h\\ %s\\ [%cn]"
#git ld : List oneline commits showing dates (relative)
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
#git lda : List oneline commits showing dates (absolutes)
lda = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
# git fl / git filelog : You can see all the commits related to a file,
# with the diff of the changes with git log -u which i shortened to fl for filelog
filelog = log -u
fl = log -u
#git ml (Modified files in Last commit)
ml = "!git ll -1"
#git dl (Diff Last commit)
dl = diff --cached HEAD^
#git f : Find a file path in codebase
f = "!git ls-files | grep -i"
#git grep : Search/grep your entire codebase for a string:
grepcodebase = grep -Ii
#git grepmessage : Search commit messages containing the given string
grepmessage = log --grep -Ii
#git grepcode : Search commits introducing/removing the given string in the code
grepcode = log -S
#git grephelp : echo help for searching commit
grephelp = !echo "git log --author [author] [-i = ignore case] --grep [commit message] -S [source Code] --after ... --before ... [--all-match for AND]"
######################
#
#Submodules aliases
#
######################
#git sm-trackbranch : places all submodules on their respective branch specified in .gitmodules
#This works if submodules are configured to track a branch, i.e if .gitmodules looks like :
#[submodule "my-submodule"]
# path = my-submodule
# url = [email protected]/my-submodule.git
# branch = my-branch
sm-trackbranch = "! git submodule foreach -q --recursive 'branch=\"$(git config -f $toplevel/.gitmodules submodule.$name.branch)\"; echo \"In $name, switching to $branch\"; git checkout $branch || true'"
#sm-pullrebase :
# - pull --rebase on the master repo
# - submodule-trackbranch on every submodule
# - pull --rebase on each submodule
#
# Important note :
#- have a clean master repo and subrepos before doing this !
#- this is *not* equivalent to getting the last committed master repo + submodules !
# if some submodules are one branches that have evolved since the last master repo commit,
# they will be using those more recent commits !
#
# (Note : On the contrary, `git submodule update` will stick to the last committed SHA1 in the master repo)
sm-pullrebase = "! git pull --rebase; git submodule update; git sm-trackbranch ; git submodule foreach 'git pull --rebase' "
# `git sm-diff` will diff the master repo *and* its submodules
sm-diff = "! git --no-pager diff && git submodule foreach 'git --no-pager diff' "
sm-diff-quiet = diff --submodule
# `git spush` will ask to push also submodules
sm-push = push --recurse-submodules=on-demand