Git diffs that are nothing

I was looking at this Git check-in today and notice many changes that showed up in the diff that were not really changes. I am not sure why diff identified them as changes, but maybe some tabs were converted to spaces or something like that. When lines of code are identified by diff as changed, but there are really no changes cause clutter in the commit. It is hard to determine exactly what has changed and others who review the code will have to spend extra time analyzing diffs that turn out to be nothing.

A good thing to remember to do before committing code to Git is to remove changes from your files that show up in diff, but are not really changes. Using the SourceTree app this can be done easily. It lets you discard parts of the file that show up in diff that really did not change. Check all of the changes in all of the files you plan to commit first, and then commit.

This will help others in the project and keep the commit logs clean.

Advertisements

2 thoughts on “Git diffs that are nothing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s