跳到主要内容

git bash里alias

最后更新于:

git bash里alias

给自己git bash终端配置个变量吧,方便一键提交发布博客。

配置

 1# 1. 用追加模式写入函数
 2tee -a /etc/profile <<'EOF'
 3rz() {
 4  cd /d/hugo-teek-private
 5  git status
 6  git pull
 7  echo "*******************************************"
 8  
 9  git add -A
10  git commit -m "auto commit: $(date '+%Y-%m-%d %H:%M:%S')"
11  git push
12  git status
13
14  echo "*******************************************"
15  echo "RouxZhee is yyds!"
16  echo "明心见性,向内求索,爱自己"
17}
18EOF
19
20# 2. 立即生效
21source /etc/profile
22
23# 3. 测试
24rz

验证

测试符合预期:

 1Administrator@DESKTOP-VDG9SBM MINGW64 /d/hugo-teek-private (master)
 2$ rz
 3On branch master
 4Your branch is up to date with 'origin/master'.
 5
 6Changes not staged for commit:
 7  (use "git add <file>..." to update what will be committed)
 8  (use "git restore <file>..." to discard changes in working directory)
 9        modified:   "hugo-teek-site/content/docs/65.RouxZhee/100.\345\205\266\345\256\203\351\205\215\347\275\256/160.git bash\351\207\214alias.md"
10
11no changes added to commit (use "git add" and/or "git commit -a")
12Already up to date.
13*******************************************
14warning: in the working copy of 'hugo-teek-site/content/docs/65.RouxZhee/100.其它配置/160.git bash里alias.md', CRLF will be replaced by LF the next time Git touches it
15[master 1d08bd0] auto commit: 2026-04-22 07:52:37
16 1 file changed, 9 insertions(+), 3 deletions(-)
17Enumerating objects: 15, done.
18Counting objects: 100% (15/15), done.
19Delta compression using up to 8 threads
20Compressing objects: 100% (8/8), done.
21Writing objects: 100% (8/8), 676 bytes | 676.00 KiB/s, done.
22Total 8 (delta 7), reused 0 (delta 0), pack-reused 0 (from 0)
23To https://cnb.cool/onedayxyy/hugo-teek-private
24   cea754a..1d08bd0  master -> master
25On branch master
26Your branch is up to date with 'origin/master'.
27
28nothing to commit, working tree clean
29*******************************************
30RouxZhee is yyds!
31明心见性,向内求索,爱自己
32
33Administrator@DESKTOP-VDG9SBM MINGW64 /d/hugo-teek-private (master)

结束。

最新文章

文档导航