Diff is a command line tool which lets you compare files line by line. It outputs the difference as a patch which can later be used to change the oldfile into newfile.
To create a diff:
diff -u --minimal oldfile newfile
Manual page: Diff manual page