@jswork/ushell-module-git 1.0.40 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.sh +5 -2
- package/modules/10-fixup.sh +22 -0
- package/package.json +1 -1
package/index.sh
CHANGED
|
@@ -66,6 +66,8 @@ alias ga='git add '
|
|
|
66
66
|
alias gb='git branch '
|
|
67
67
|
alias gbh='git branch -h'
|
|
68
68
|
alias gd='git diff'
|
|
69
|
+
alias gdd='git diff --staged'
|
|
70
|
+
alias gdc='git diff --cached'
|
|
69
71
|
alias gk='gitk --all&'
|
|
70
72
|
alias gx='gitx --all'
|
|
71
73
|
alias gg="${ROOT_PATH}/modules/05-quick-commit.sh"
|
|
@@ -76,9 +78,11 @@ alias ggg='gaa && gcm "wip" && gp'
|
|
|
76
78
|
## git tags:
|
|
77
79
|
alias gcd=". ${ROOT_PATH}/modules/01-gcd.sh"
|
|
78
80
|
alias ggt="${ROOT_PATH}/modules/03-quick-tag.sh"
|
|
81
|
+
alias fixup="${ROOT_PATH}/modules/10-fixup.sh"
|
|
79
82
|
alias git-reset="${ROOT_PATH}/modules/04-reset-git.sh"
|
|
80
83
|
alias git-clean="${ROOT_PATH}/modules/06-git-clean.sh"
|
|
81
84
|
|
|
85
|
+
|
|
82
86
|
# check git repo size
|
|
83
87
|
alias git-size="git count-objects -vH"
|
|
84
88
|
|
|
@@ -90,7 +94,6 @@ alias mvg="${ROOT_PATH}/modules/08-mvg.sh"
|
|
|
90
94
|
|
|
91
95
|
# oprr
|
|
92
96
|
alias oprr="${ROOT_PATH}/modules/09-oprr.sh"
|
|
93
|
-
alias opc="open $(guc -c)"
|
|
94
97
|
|
|
95
98
|
# stash
|
|
96
99
|
alias gst1='git stash'
|
|
@@ -104,5 +107,5 @@ alias gst2='git stash pop'
|
|
|
104
107
|
|
|
105
108
|
# git-completion
|
|
106
109
|
if [ -f ~/.git-completion.bash ]; then
|
|
107
|
-
|
|
110
|
+
. ~/.git-completion.bash
|
|
108
111
|
fi
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# 检查是否传入了目标提交
|
|
4
|
+
if [ -z "$1" ]; then
|
|
5
|
+
echo "Usage: git-fixup-rebase <target-commit>"
|
|
6
|
+
return 1
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
# 获取目标提交
|
|
10
|
+
TARGET_COMMIT=$1
|
|
11
|
+
|
|
12
|
+
# 找到目标提交的上一条提交
|
|
13
|
+
BASE_COMMIT=$(git rev-parse $TARGET_COMMIT^)
|
|
14
|
+
|
|
15
|
+
# 如果没有找到上一条提交,提示错误
|
|
16
|
+
if [ -z "$BASE_COMMIT" ]; then
|
|
17
|
+
echo "Error: Could not find the parent commit of $TARGET_COMMIT."
|
|
18
|
+
return 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# 执行交互式变基
|
|
22
|
+
git rebase -i --autosquash $BASE_COMMIT
|