问题
I have committed some code with some format but the origin has some other format. The reviewer is asking me to revert all my changes and I am searching for some UI tool or some way in Git to remove formatting and give the actual result.
回答1:
I think you might have a look at git diff, in particular the two following options:
-b, --ignore-space-change
Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent.
-w, --ignore-all-space
Ignore whitespace when comparing lines. This ignores differences even if one line has whitespace where the other line has none.
So running git diff --ignore-all-space
However, if what you define by formatting is not just whitespace, I guess you have to do it by hand
回答2:
Kdiff3 is the tool i needed to get my work done This is a GUI tool for UNIX systems which can compare two file remove conflicts check for changes
回答3:
If you use intellij
, consider using the version control
tool provided by it.
The below link details on how to get a diff between two branches. https://stackoverflow.com/a/49642681/2960555
for a single file diff, You can right click on file -> git -> compare.
A new window will gets opened. select ignore options in that.
来源:https://stackoverflow.com/questions/31051346/is-there-any-way-to-compare-two-files-in-git-without-their-formatting-changes