-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.git_custom
32 lines (24 loc) · 1.41 KB
/
.git_custom
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
[core]
editor = micro
[push]
default = simple
[alias]
# For force pushing, it checks that you have fetched the latest changes first
pushf = push --force-with-lease
# When you want to amend the commit but don't need to edit the commit message
commend = commit -a --amend --no-edit
# A prettier git log
log2 = log --abbrev-commit --format=format:\"%C(bold blue)%h%C(reset) - %C(white)%s%C(reset)\" --max-count=10
# A prettier list of branches
branchmin = for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short),%(contents:subject)'
# Creates the PR using the github cli. Also give you the option of filling in the PR description from a template
pr-create = gh pr create
# These three together publish the branch whenever you push, creating it on GitHub if it doesn't exist, then uses pr-create
branch-name = rev-parse --abbrev-ref HEAD
force-publish = "! git push --set-upstream origin $(git branch-name)"
pushp = "! if [ \"$(git branch-name)\" != \"master\" ]; then git force-publish; else echo 'on master, not publishing' && exit 1; fi && gh pr create"
# Runs the pull_pull_request script. Replace /repos/ with whatever dir you use to store code
ppr = "!f() { ~/repos/pull_pull_request.py $@; }; f"
# For those fingers that run too fast.
puhs = push
main-branch = "!git symbolic-ref refs/remotes/origin/HEAD | cut -d'/' -f4"