I have a file called file.txt. I copy it, call it fileOld.txt and make some small changes. I then make bigger changes to file.txt. I have not committed anything.
How can I see what changes I made in fileOld.txt, ie. how can I compare fileOld.txt with the latest committed version of file.txt?
The best I've come up with so far is:
diff -u <(git show origin/HEAD:file.txt) fileOld.txt
which is fine, but I wondered if git supported this directly somehow?
This diffs file1.txt from the previous commit to your current file2.txt.
git diff HEAD^:file1.txt file2.txt
You can ofcourse replace HEAD^ with the commit SHA1.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.