所以我在为我的提交正确添加数据时遇到了问题。
我有类似的东西:
@@ -6,6 +9,5 @@
#include "incfile.h"
bool func3(int&, const char*);
-int func1(const int, std::vector<std::unique_ptr<type> >&);
-void func2(const std::vector<std::unique_ptr<type> >&);
+int func1(const int, std::vector<std::shared_ptr<type> >&);
void func4(const int);
我试图仅将更改暂存到func2
我希望在差异提交中更改为func1
,而我正在努力,因为我每次和每次组合都会删除{{1或者行或其他任何导致补丁不适用的行。我想我可以简单地从-
前面移除-
并删除func1
的{{1}}行,但它会没问题,但它无效。
答案 0 :(得分:1)
这样做:
int func1(const int, std::vector<std::unique_ptr<type> >&);
-void func2(const std::vector<std::unique_ptr<type> >&);
换句话说,将第一个-
替换为(空格)并完全删除最后一行。
答案 1 :(得分:0)
您可以尝试git rebase -i ...
设置一系列修改提交。 -i
(交互式)标志在每次提交时给出的选项之一是e
dit它。这使得流程停止,因此您可以在闲暇时更改提交(在这种情况下,编辑修改后的文件),然后git add incfile.h
记录更改,git rebase --continue
重播其他提交。
如果你是偏执狂,你可以通过提示创建一个分支来愚弄,并且不会冒git checkout -b experiment
丢失它并冒险使用新的experiment
分支。