/
.gitconfig
71 lines (49 loc) · 2.32 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
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
[alias]
# 普通のエイリアス
ck = checkout
br = branch
st = status -s
# fetchしてswitch
fetch-and-switch = "!f() { git fetch; git switch \"$1\"; }; f"
fs = fetch-and-switch
# 対象ブランチを削除してから再作成
delete-and-checkout = "!f() { git branch -D \"$1\"; git checkout -b \"$1\"; }; f"
# localのブランチをすべて削除
delete-branches = !git branch -D `git branch | xargs`
# 新規ブランチを作成して空コミットを作成
new-branch = "!f() { git checkout -b \"$1\"; git commit --allow-empty -m \"$1\"; }; f"
# 変更のない状態でコミットを作成
em = !git commit --allow-empty
# 最新状態のmainブランチにrebaseする
refresh-main = !git checkout main && git pull && git checkout -
# 最新状態のmainブランチにrebaseする
rebase-to-latest-main = !git checkout main && git pull && git checkout - && git rebase main
# 現在のブランチを表示
current = !git symbolic-ref --short HEAD
update = !git add . && git commit -m "update"
# originからpullする
pull-from-origin = !git pull origin $(git current)
po = pull-from-origin
# 現在チェックアウト中のブランチを除いてlocalのブランチをすべて削除
; delete-all-branches = sh -c 'git branch -D `git branch --merged | grep -v \* | xargs`'
# なにも変更差分がない状態でコミットを作ってpushする
pr = "!sh -c 'git checkout -b $1 && git commit --allow-empty -m $1 && git push' -"
# 現在ブランチをリモート(origin)の最新の状態に書き換える
reset-current = !git fetch && git reset --hard origin/$(git current)
# 現在のコミットを壊してコミット未反映状態にする
break = reset HEAD^
# 今の作業内容をammendする
forget = !git add . && git commit --amend
fg = !git forget
cm = commit
cma = commit --amend
amend = commit --amend
# 新規コミットを作る
create = !git add . && git commit
cr = !git create
# rebaseでもmergeでもcherry-pickでもabortする
abort = !git rebase --abort || git merge --abort | git cherry-pick --abort
# rebaseの時の変更を反映する
change = !git add . && git rebase --continue
# コミットされていないものはすべて消す
vanish = !git reset . && git checkout . && git clean -fd