-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitaliases
50 lines (37 loc) · 2.29 KB
/
.gitaliases
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
[alias]
# List all aliases
aliases = !git config -l | grep alias | cut -c 7-
# Prettier version of git log
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ar)%C(bold blue)<%an>%Creset' --abbrev-commit
# Like the lg command (see above), but also include a diff for each commit
ld = lg -p
# Another version of git log, showing which files were actually modified in each commit
ll = log --pretty='format:%Cred%h%C(yellow)%d %Creset%s%C(bold blue) [%cn]' --decorate --numstat
# Switch to the previous branch (if you call `git toggle` again, git switches back to the first branch)
toggle = checkout -
# Fetch all branches from remote and clean up your local references
fap = !git fetch --all -p && git prune && :
# Use this if you want to replace your local branch with the latest version of the remote branch
# (e.g. if someone else did a force-push and you simply want to continue on top of their work).
# Usage: `git forcepull`
forcepull = !git fetch && branchname=`git rev-parse --symbolic-full-name --abbrev-ref HEAD` && git reset --hard origin/$branchname && :
# Reset and remove untracked files and folders from the working tree
boom=!git reset --hard && git clean -df && :
# Undo some commits and put the changes from those commits onto the stage.
# Example: `git rewind HEAD~3` to undo the last 3 commits.
rewind = reset --soft
# Commit changes and write a commit message.
# Example: `git cm "This is my commit summary"`
cm = commit -a -m
# Fast-forward an existing tag to the current commit, both locally and on the remote.
# Example: `git fftag v1.0` will delete the remote "v1.0" tag, overwrite the local "v1.0" tag with a new one and then push the new tag to the remote.
fftag = !1>/dev/null && git push origin :refs/tags/$1 && git tag -fa $1 && git push origin --tags && :
# Shows an overview of file changes of the current branch compared to main
changes = diff --stat main...HEAD
# Some short aliases for simple commands that are used frequently
re = reset --hard HEAD
co = checkout
cp = cherry-pick
done = !git branch --merged | egrep --invert-match '(main|master|release/|\\* )'
# Deletes all local branches that have been merged into the current branch
dropdone = !git done | xargs -n 1 git branch -d