gpt4 book ai didi

git - 在交互式 rebase 提交消息中转义 # 字符

转载 作者:太空狗 更新时间:2023-10-29 12:52:06 25 4
gpt4 key购买 nike

<分区>

在 git 中执行交互式 rebase 之后,我想要一个以 #(哈希或井号)字符开头的提交消息,但是以 # 开头的行是被视为评论并被忽略。

有没有办法转义 # 字符,使我的提交消息实际上以 # 开头?

更多详情

我正在使用以下方式执行交互式 rebase :

git rebase -i HEAD~4

然后,我在编辑器中做任何需要做的事情,例如:

pick b010299 #91691 Add test for logging in with valid credentials
reword 5e9159d 91691 Implement log-in feature
pick 2735aa3 #91691 Re-factor logic
pick 14bd500 #91691 Tidy up 'using' declarations

# Rebase 60d6e3f..14bd500 onto 60d6e3f
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

然后 git 在我的文本编辑器中加载提交消息,用于我要改写的提交,但我想在开头用 # 保存我的提交消息:

#91691 Implement log-in feature

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# rebase in progress; onto 60d6e3f
# You are currently editing a commit while rebasing branch 'master' on '60d6e3f'.
#
# Changes to be committed:
# modified: My.Website.LogInController.cs

但这意味着我的提交信息将被忽略。我该如何制作提交消息 #91691 Implement log-in feature

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