请教一个 git 指令(根据提交次数找到 commit id)

310 天前
 wjx0912

当前分支代码 checkout 后 git rev-list --count main 可以得到 main 分支的 commit 次数。

这个次数最终编译到 dll 版本号里面,比如 1.0.0.2345

能不能根据 2345 找到对应的 git 的 commit id

万分感谢

741 次点击
所在节点    git
3 条回复
wjx0912
310 天前
自言自语答复一下:git rev-list main --reverse | nl | grep -w 2345
retanoj
310 天前
假如我知道了 git rev-list main --reverse 用法,我就会
git rev-list main --reverse | head -n 2345 | tail -n 1
wjx0912
310 天前
@retanoj good

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/953747

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX