ask github or sourcetree to ignore moved lines?

I'm using Git to keep track of the changes I make to my project. I often move entire sections around within my files.

When I view diffs using Sourcetree and GitHub for OSX, it shows me those moved lines as deleted (and shows them as new lines elsewhere). This is confusing visually.

How do I instruct Sourcetree or GitHub to ignore moved lines, and only show lines as deleted if they are truly gone?

Answers


Short answer, you can't.

If you don't like default diffs calculated by git, you can try to use --patience (Generate a diff using the "patience diff" algorithm.) and --histogram (Generate a diff using the "histogram diff" algorithm.) options of git diff.

Also this might help Customizing-Git-Git-Attributes#Binary-Files see Diffing Binary Files.


An alternative is to use the command line. You can instruct git to try and guess when lines of code have been moved

git blame -M -w <file>

should show you the author and sha1's of what it thinks are the original authors of those lines. It's an educated guess, so it might be wrong sometimes.


Need Your Help

How can I get NDepend to run as part of my build process?

build tfs build-process visual-studio-2013 ndepend

I love NDepend and would love it even more if I could figure out how to get it to run a report overnight as part of our build process.

How to use Git for graphics and sound-intensive iOS development?

ios xcode git

As an example, I have a game that consists of some 800 images and about 400 sound clips. How would you approach using Git with such a project?