相关疑难解决方法(0)

使用hashmark(#)启动git commit消息

Git #在提交时处理以注释行开头的行.这在使用票证跟踪系统时非常烦人,并且试图在该行的开头写入票号,例如

#123 salt hashed passwords
Run Code Online (Sandbox Code Playgroud)

git将简单地从提交消息中删除该行.有没有办法逃脱哈希?我试过\!,但没有任何工程.之前#的空白被保留,因此它们也不是解决问题的有效方法.

git ticket-system commit ticket-tracking

266
推荐指数
7
解决办法
5万
查看次数

Git交互式rebase而无需打开编辑器

Git允许某些命令创建或修改提交而无需先打开编辑器,例如:

git commit --amend --no-edit
git commit --fixup=HEAD^
Run Code Online (Sandbox Code Playgroud)

我已设置rebase.autosquashtrue,因此交互式rebase的待办事项列表会自动重新排序.有没有办法立即执行rebase,而无需先打开编辑器,如下所示:

git rebase -i --no-edit HEAD~3
Run Code Online (Sandbox Code Playgroud)

git rebase git-rebase

21
推荐指数
3
解决办法
2887
查看次数

如何压制`git rebase --continue`的编辑器?

我经常重新定义交互式以在历史记录中进行微小的更改(例如删除空白行或编辑一行).在大多数情况下,这些变化是基于一些同行评审.

起初我做这样的改变:

git rebase --interactive 83bbeb27fcb1b5e164318fa17c55b7a38e5d3c9d~
# replace "pick" by "edit" on the first line
# modify code
git commit --all --amend --no-edit
git rebase --continue
Run Code Online (Sandbox Code Playgroud)

如果以下提交之一中存在合并冲突,我将解决它们并执行此操作:

git rebase --continue
# the commit message is shown, but does not have to be changed, so I just save and exit the editor
git rebase --continue
# the commit message is shown, but does not have to be changed, so I just save and exit the editor
git rebase --continue
# the …
Run Code Online (Sandbox Code Playgroud)

git macos command-line git-rewrite-history

12
推荐指数
2
解决办法
936
查看次数