如何创建手动差异?

发布于 2024-10-29 21:40:49 字数 137 浏览 0 评论 0原文

我有一个现有的代码库,我想突出显示其中的特定部分以进行演示。我们使用审查板,它允许用户上传差异并方便地将其与相关存储库进行比较。

鉴于此,有没有一种好方法可以手动创建差异,以便它将显示已添加的相关部分?我想到的唯一方法是删除相关代码并反转差异。

I have an existing codebase that I'd like to highlight particular portions of for demonstration purposes. We use Review Board, which allows a user to upload a diff and conveniently compare it against the repository in question.

That given, is there a good way to create a diff manually so it will show the relevant portions as having been added? The only way that comes to mind is by deleting the relevant code and reversing the diff.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光病人 2024-11-05 21:40:49

手动使用 diff 命令:

cp yourfile.py yourfile.py.orig
# then edit the file
# and generate the diff
diff -Naur yourfile.py.orig yourfile.py

如果您已经使用版本控制软件(如 git、svn、hg...),则可以在提交之前直接使用它们:

hg diff
git diff
svn diff

Use diff command manually:

cp yourfile.py yourfile.py.orig
# then edit the file
# and generate the diff
diff -Naur yourfile.py.orig yourfile.py

If you are already using a version control software (like git, svn, hg...), you can directly use them before commit:

hg diff
git diff
svn diff
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文