How do I create a manual diff?
I have an existing codebase that I'd like to开发者_JS百科 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.
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
精彩评论