小编Wil*_*ung的帖子

从其他分支中挑选一组提交,跳过空提交

我正在使用合并一堆提交cherry-pick

git rev-list --reverse something-begin..something-end | git cherry-pick --stdin
Run Code Online (Sandbox Code Playgroud)

然后以错误消息结束

...
You are currently cherry-picking commit xxxyyy.

nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

If you wish to skip this commit, use:

    git reset

Then "git cherry-pick --continue" will resume cherry-picking the remaining commits.
Run Code Online (Sandbox Code Playgroud)

我不想选择任何这些空提交。

git reset; git cherry-pick --continue每次停靠和提示都要输入,这很烦人。

为什么它没有提供一个--skip-empty选项?然后我就到了这个线程:

http://markmail.org/message/yowzaetyu32ulvz7

太糟糕了,我检查了我的 git 版本 …

git

5
推荐指数
1
解决办法
7700
查看次数

为什么 bash 的行注释技巧不适用于感叹号“!”

ref Bash 的内联注释?

我们可以使用这个技巧

echo abc `#put your comment here` \
     def `#another chance for a comment` \
     xyz etc
Run Code Online (Sandbox Code Playgroud)

但如果我们在评论中有感叹号,这些就不起作用

echo 1 `# 2 !3`
<error>
-bash: !3: event not found
Run Code Online (Sandbox Code Playgroud)

如果我们直接输入它不会被转换为事件

# 2 !3
<that is OK>
Run Code Online (Sandbox Code Playgroud)

看来我们需要另一个#符号来解决这个问题。

echo 1 `# 2 #!3`
<that is OK>
1
Run Code Online (Sandbox Code Playgroud)

或者我们是否必须将前导#符号加倍?

echo 1 `# # 2 !3`
<that is OK>
1
Run Code Online (Sandbox Code Playgroud)

bash

5
推荐指数
1
解决办法
336
查看次数

标签 统计

bash ×1

git ×1