在我提交的Git中,例如.A - B - C我想编辑B提交,我
git rebase -i <A-commit-hash>,edit在Bcommit 前写命令,B提交后,git rebase会立即停止,因此我可以修复任何我想要的东西git commit --amend,
git rebase --continue.据我所知,这是如何做到这一点的最佳实践.使用这种方法,我可以编辑过去的任何提交(只要它还没有被推送到远程分支),而且使用-p标志我甚至可以保留合并.这太棒了.
我目前的问题是:我在合并提交中的一行上做了一个错误(拼写错误)(当合并两个分支时解决冲突).
我想解决它,但我不知道如何git rebase停止合并提交.该git rebase -p -i <blah>列表忽略了合并提交,所以我不能edit在它前面写命令并git rebase停在那里让我编辑它.
有什么帮助吗?我只想在合并提交中修复此行,同时保留它之后的所有提交(和合并).
谢谢.
TypeScript 有没有办法创建高级类型文档中Flags提到的类型的嵌套版本?
这很有效:
type Flags<T> = {
[P in keyof T]: boolean;
}
interface Colors {
red: string;
green: string;
blue: string;
}
const activeColors: Flags<Colors> = {
red: true,
green: true,
blue: false
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我想创建一个NestedFlags能够处理这样的嵌套对象的类型呢?
interface NestedColors {
red: string;
green: string;
blue: string;
more: {
yellow: string;
violet: string;
black: string;
}
}
const activeNestedColors: NestedFlags<NestedColors> {
red: true,
blue: false,
green: true,
more: {
yellow: false,
violet: true,
black: true
} …Run Code Online (Sandbox Code Playgroud) 假设我有一个由外部工具生成的以下界面:
\ninterface Animals {\n turtle: { shellHardness: number };\n fox: { whatDidItSay: string } | null;\n}\nRun Code Online (Sandbox Code Playgroud)\n我想Animals为乌龟和狐狸定义(从中提取)类型,但不\xe2\x80\xa6| null为狐狸定义类型。这对乌龟来说很容易,因为没有 null:
type Turtle = Animals["turtle"];\nRun Code Online (Sandbox Code Playgroud)\n但我该如何为狐狸做这件事呢?我想象可能有某种ExtractNullable类型可以消除可为空性:
type Fox = ExtractNullable<Animals, "fox">;\nRun Code Online (Sandbox Code Playgroud)\n不幸的是我无法ExtractNullable正确定义类型。我尝试了以下方法:
type ExtractNullable<T, K extends keyof T> = T[K] extends null ? never : T[K];\nRun Code Online (Sandbox Code Playgroud)\n\xe2\x80\xa6但它不起作用。TypeScript Playground 仍然告诉我类型Fox被定义为type Fox = { whatTheySaid: string; } | null而不是type Fox = { whatTheySaid: …