-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitconfig
45 lines (40 loc) · 1.53 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
[core]
editor = vim
[init]
defaultBranch = main
# Git aliases: https://git.wiki.kernel.org/index.php/Aliases#Advanced_aliases_with_arguments
[alias]
# Draws graphs of the repository in the console
draw = "!f() { git log --decorate --graph --oneline --abbrev=8 \"$@\"; }; f"
draw-all = draw --all
da = draw-all
# Fetches branches and tags from all remotes. Prunes remote-tracking branches where they no longer exist on the remote,
# but does not prune tags as tags fetched from different remotes share the same local namespace.
# See https://git-scm.com/docs/git-fetch#_pruning for more information.
fetch-prune = "!f() { git fetch --all --prune --tags \"$@\"; }; f"
fp = fetch-prune
# Usage: git remerge new_first_parent new_second_parent
#
# Creates a new merge commit from 2 parents. This operation commits the new merge, so anything in the staging area
# will be included.
# Useful for squashing multiple subsequent merges (and their conflict resolutions) into a single merge.
#
# Reference: https://stackoverflow.com/questions/1725708/git-rebase-interactive-squash-merge-commits-together
#
# Example: git remerge y f
#
# x --- y --------- M1 -------- M2 (my-feature)
# / / /
# / / /
# a --- b --- c --- d --- e --- f (release)
#
# x --- y ---- M (my-feature)
# / /
# / /
# a --- ... -- f (release)
#
remerge = "!f() { \
git reset --soft $1; \
git update-ref MERGE_HEAD $2; \
git commit; \
}; f"