git 命令行提交_通过命令行获取Git提交ID

git 命令行提交

I know just enough git to be dangerous.  I'm not doing advanced bisecting but I can stash, rebase, and reset with the best of them.  One new trick I learned from my boss, Luke Crouch, saves me loads of time:  getting the commit ID via command line.  For years I would merge a PR, go the project's main page, and copy the commit ID so that I could push code to staging and production.  Always seemed like an extra step rather than just making it happen from the terminal.  Here's the magical command:

我知道git够危险。 我没有进行高级二等分,但是我可以利用它们中的最好的东西进行存储,变基和重置。 我从老板卢克·克劳奇(Luke Crouch)那里学到的一个新技巧为节省了很多时间:通过命令行获取提交ID。 多年来,我会合并PR,转到项目的主页,然后复制提交ID,以便将代码推送到暂存和生产环境。 似乎总是一个额外的步骤,而不仅仅是在终端上实现它。 这是神奇的命令:


git rev-parse HEAD


Of course you need to update your local repo to remote master, but you do that anyway, right?  Hopefully this will become a timesaver the same way it has for me!

当然,您需要将本地存储库更新为远程主数据库,但是您还是要这样做,对吗? 希望这对我来说将成为一种节省时间的方式!

翻译自: https://davidwalsh.name/get-git-commit-id

git 命令行提交

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值