【发布时间】:2021-09-08 22:59:23
【问题描述】:
我想使用一个 shell 脚本来自动推送一定数量的远程提交。 自动推送效果很好,但我想做的是,我想手动 git add 和 git commit 并且我只想自动推送。
比如本地有3个commit,推送最旧的commit 3和commit 2,留下最新的commit 1。
git-auto.sh
#!/usr/bin/env sh
baseDir = ~/dev/git-playground
cd ${baseDir}
afewCommits=`git commit | head -n 2` <- don't know how
if [ -z "$afewCommits" ]; then
echo '##### file not found #####'
exit
fi
git push
请帮帮我
【问题讨论】:
-
git push origin HEAD^:master