bash - 我怎样才能得到最后一个在遥控器上提交的人的名字?
问题描述
我知道-force-with-lease
只有当我是最后一个提交者时,该选项才允许我强制执行,但我想允许覆盖它:
git push playground $current_branch:master --force-with-lease
if ! [[ "$?" == "0" ]]; then
last_committer="$(git some command)"
ask_continue "the last committer was $last_committer, would you like to push force?"
git push playground $current_branch:master --force
fi
在那个例子中,我想知道git some command
会是什么。
解决方案
git show --quiet --pretty=format:%an
--quiet
- 抑制差异输出
%an
- 是作者姓名(对于所有其他格式,请单击此)
如果您想查看谁在特定分支上进行了最后一次提交
git show --quiet --pretty=format:%an origin/branch-name
推荐阅读
- c# - How to check if member A paid for month January in 2019 and if he did disable option to make payment again in 2019 for monthJanuary?
- reactjs - 如何在 React Native 中从孙子到祖父母,然后再回到祖父母的孩子
- swift - 如何修复转义关闭?错误是:转换非转义值可能允许它转义
- reactjs - 打字稿对象文字可能只指定已知属性错误
- html - 子菜单出现时如何向下移动最后一个div
- android - Can't return current keyboard language
- java - 使用默认服务帐户的 Bigquery 插入作业
- javascript - 如何在 HTML 元素而不是 JavaScript 警报中显示 JavaScript 函数的输出?
- javascript - 我正在尝试从最低级别组件的输入字段中捕获数据
- javascript - How to get a certain number of unique random numbers in a certain range?