gpt4 book ai didi

git - 如何只向 GIT 提交一条消息?

转载 作者:IT王子 更新时间:2023-10-29 01:14:43 24 4
gpt4 key购买 nike

假设我一直在一个分支上工作并且已经提交了我的工作但是想在分支待办事项列表的下一步日志中添加一条消息。次我可能想这样做包括:

  • 切换分支从事其他工作 - 需要提醒自己下一步该做什么
  • 周末
  • 其他

是否可以在不提交任何文件的情况下提交到 git?换句话说:是否可以只向 GIT 提交一条消息?

最佳答案

是的。有可能的。我永远记不起怎么做,总是需要谷歌(所以我写了一个问答,希望这能帮助我记住)。

命令是:

git commit --allow-empty --only

--allow-empty 的文档如下:

Usually recording a commit that has the exact same tree as its soleparent commit is a mistake, and the command prevents you from makingsuch a commit. This option bypasses the safety, and is primarily foruse by foreign SCM interface scripts.

文档很有意义,但不容易搜索。

关于git - 如何只向 GIT 提交一条消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18879104/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com