@jswork/ushell-module-git 1.0.41 → 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 +3 -1
- package/modules/10-fixup.sh +22 -0
- package/package.json +1 -1
package/index.sh
CHANGED
|
@@ -78,9 +78,11 @@ alias ggg='gaa && gcm "wip" && gp'
|
|
|
78
78
|
## git tags:
|
|
79
79
|
alias gcd=". ${ROOT_PATH}/modules/01-gcd.sh"
|
|
80
80
|
alias ggt="${ROOT_PATH}/modules/03-quick-tag.sh"
|
|
81
|
+
alias fixup="${ROOT_PATH}/modules/10-fixup.sh"
|
|
81
82
|
alias git-reset="${ROOT_PATH}/modules/04-reset-git.sh"
|
|
82
83
|
alias git-clean="${ROOT_PATH}/modules/06-git-clean.sh"
|
|
83
84
|
|
|
85
|
+
|
|
84
86
|
# check git repo size
|
|
85
87
|
alias git-size="git count-objects -vH"
|
|
86
88
|
|
|
@@ -105,5 +107,5 @@ alias gst2='git stash pop'
|
|
|
105
107
|
|
|
106
108
|
# git-completion
|
|
107
109
|
if [ -f ~/.git-completion.bash ]; then
|
|
108
|
-
|
|
110
|
+
. ~/.git-completion.bash
|
|
109
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
|