Finding Merge Changes Without Whitespace Changes in GitHub
When we’re on boarding new programmers we always institute a code review process where at least one programmer experienced with the project reviews the work of the new programmer. We use GitHub’s Pull Request feature to help us do this. Most of the changes are easy for us to review and then approve or tell the programmer they need to make changes. Every so often we run into a file where GitHub lets us down (really I don’t know what else they would do here :-)):
The issue was that this particular file had it’s line endings changes on the master branch but not the pull request branch it was messing up the whole system. To try and make sense of all the changes we had to resort to using the command line:
git diff "pr/#" master -w -- file\path\here > temp.txt
This command is calculating the differences in the file (“file\path\here”) between the pull request branch (“pr/#”) and the master branch but it’s ignore all whitespace when comparing the two (“-w”).
This produced a much shorter (20 lines) list of changes which we then had to manually merge in but at least the programmer didn’t loose all their work.
Scott Keck-Warren
Scott is the Director of Technology at WeCare Connect where he strives to provide solutions for his customers needs. He's the father of two and can be found most weekends working on projects around the house with his loving partner.
Top Posts
- Working With Soft Deletes in Laravel (By Example)
- Fixing CMake was unable to find a build program corresponding to "Unix Makefiles"
- Upgrading to Laravel 8.x
- Get The Count of the Number of Users in an AD Group
- Multiple Vagrant VMs in One Vagrantfile
- Fixing the "this is larger than GitHub's recommended maximum file size of 50.00 MB" error
- Changing the Directory Vagrant Stores the VMs In
- Accepting Android SDK Licenses From The OSX Command Line
- Fixing the 'Target class [config] does not exist' Error
- Using Rectangle to Manage MacOS Windows