Skip to content

Commit b2e54ed

Browse files
committed
add more git aliases
1 parent 8bf2b62 commit b2e54ed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

global.gitconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
#### ALIASES
9393
[alias]
9494
p = "!f(){ git push || (git pull && git push) ; }; f"
95+
pu = "!f() { if ! git is-clean; then git st; git pull; git pop; else git pull; fi; }; f"
96+
hard = "!f() { git reset --hard origin/$(git current-branch) ; }; f"
9597
a = add --all
9698
m = commit --message
9799
cam = "!f(){ git add -A && git commit -m \"$@\" ; }; f"
@@ -117,7 +119,7 @@
117119
overwrite = !git a && git amend && git force
118120
merge-rebase = "!f() { actual=$(git current-branch) && git checkout $1 && git rebase $actual && git force && git checkout $actual && git merge $1 ; }; f"
119121
squash-branch = "!f() { git reset $(git merge-base ${2:-master} $(git current-branch)) ; git a ; git m ${1:-$(git log -1 --pretty=%B)} ; }; f"
120-
is-clean = "!f() { if ! git diff --exit-code &> /dev/null || [[ ! -z "$(git ls-files --other --directory --exclude-standard)" ]]; then exit 1; fi ; }; f"
122+
is-clean = "!f() { if ! git diff --exit-code --quiet || [[ ! -z "$(git ls-files --other --directory --exclude-standard)" ]]; then exit 1; fi ; }; f"
121123
message = "log -1 --pretty=%B"
122124
c = "checkout -"
123125
main = "!f() { git remote show origin | sed -n '/HEAD branch/s/.*: //p' ; }; f"

0 commit comments

Comments
 (0)