假设我一直在一个分支上工作并且已经提交了我的工作但是想 在分支待办事项列表的下一步日志中添加一条消息。次 我可能想这样做包括:
- 切换分支从事其他工作 - 需要提醒自己下一步该做什么
- 周末
- 其他
是否可以在不提交任何文件的情况下提交到 git?换句话说:是否可以只向 GIT 提交一条消息?
最佳答案
是的。有可能的。我永远记不起怎么做,总是需要谷歌(所以我写了一个问答,希望这能帮助我记住)。
命令是:
git commit --allow-empty --only
--allow-empty
的文档如下:
Usually recording a commit that has the exact same tree as its sole parent commit is a mistake, and the command prevents you from making such a commit. This option bypasses the safety, and is primarily for use by foreign SCM interface scripts.
文档很有意义,但不容易搜索。
关于git - 如何只向 GIT 提交一条消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18879104/