【发布时间】:2014-03-13 20:20:05
【问题描述】:
我正在为 Jenkins 作业开发自动化脚本。该脚本采用参数$1,对存储库文件进行小幅更改并推送更改。它只是这样做:
git clone repo
echo > $1
git commit -a -m 'updated'
git push
当这些 Jenkins 作业同时执行时,git push 经常失败:
! [rejected] master -> master (non-fast-forward)
这是完全可以理解的。但我想强制推送,因为已经保证每个脚本调用都会获得不同的$1。
从手册页中,我了解到:
--force
... This flag disables these checks,
and can cause the remote repository to lose commits;
use it with care.
该标志是否适合我的场景?
【问题讨论】:
标签: git git-push fast-forward