@jswork/ushell-module-git 1.0.57 → 1.0.60
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 -2
- package/modules/12-ggi.sh +1 -1
- package/modules/15-ignore-file.sh +48 -0
- package/package.json +1 -1
package/index.sh
CHANGED
|
@@ -7,6 +7,7 @@ ROOT_PATH=$(dirname $BASH_SOURCE)
|
|
|
7
7
|
source $ROOT_PATH/modules/07-git-rebase.sh
|
|
8
8
|
source $ROOT_PATH/modules/11-lazygit.sh
|
|
9
9
|
source $ROOT_PATH/modules/14-gr.sh
|
|
10
|
+
source $ROOT_PATH/modules/15-ignore-file.sh
|
|
10
11
|
|
|
11
12
|
## git base:
|
|
12
13
|
alias gl='git pull'
|
|
@@ -82,8 +83,8 @@ alias gk='gitk --all&'
|
|
|
82
83
|
alias gx='gitx --all'
|
|
83
84
|
alias gg="${ROOT_PATH}/modules/05-quick-commit.sh"
|
|
84
85
|
alias ggl="${ROOT_PATH}/modules/05-1-quick-commit-no-push.sh"
|
|
85
|
-
alias gi="oaic -al"
|
|
86
|
-
alias
|
|
86
|
+
# alias gi="oaic -al"
|
|
87
|
+
alias gi="${ROOT_PATH}/modules/12-ggi.sh"
|
|
87
88
|
alias ggg='gaa && gcm "wip" && gp'
|
|
88
89
|
|
|
89
90
|
## git tags:
|
package/modules/12-ggi.sh
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# AI: https://chat.qwen.ai/c/50e0a481-e4d1-4302-927e-0d2938ee04e8
|
|
3
|
+
# Git 忽略文件函数(不添加到 .gitignore)
|
|
4
|
+
git_ignore_file() {
|
|
5
|
+
local file="$1"
|
|
6
|
+
|
|
7
|
+
if [ -z "$file" ]; then
|
|
8
|
+
echo "错误: 请提供要忽略的文件名"
|
|
9
|
+
echo "用法: git_ignore_file <文件名>"
|
|
10
|
+
return 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
if [ ! -f "$file" ]; then
|
|
14
|
+
echo "错误: 文件 $file 不存在"
|
|
15
|
+
return 1
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# 先添加文件(如果尚未添加)
|
|
19
|
+
git add -N "$file" 2>/dev/null || true
|
|
20
|
+
|
|
21
|
+
# 使用 assume-unchanged 标记文件
|
|
22
|
+
if git update-index --assume-unchanged "$file"; then
|
|
23
|
+
echo "已设置 $file 为忽略状态"
|
|
24
|
+
echo "提示: 使用 git_unignore_file '$file' 取消忽略"
|
|
25
|
+
else
|
|
26
|
+
echo "错误: 无法设置 $file 为忽略状态"
|
|
27
|
+
return 1
|
|
28
|
+
fi
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# 取消忽略文件函数
|
|
32
|
+
git_unignore_file() {
|
|
33
|
+
local file="$1"
|
|
34
|
+
|
|
35
|
+
if [ -z "$file" ]; then
|
|
36
|
+
echo "错误: 请提供要取消忽略的文件名"
|
|
37
|
+
echo "用法: git_unignore_file <文件名>"
|
|
38
|
+
return 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# 取消 assume-unchanged 标记
|
|
42
|
+
if git update-index --no-assume-unchanged "$file"; then
|
|
43
|
+
echo "已取消 $file 的忽略状态"
|
|
44
|
+
else
|
|
45
|
+
echo "错误: 无法取消 $file 的忽略状态"
|
|
46
|
+
return 1
|
|
47
|
+
fi
|
|
48
|
+
}
|