I have a text file in main branch and also in my feature branch. I am editing the text file in feature branch and now want to see the difference between main branch and feature branch.
I am using the following command to see the difference
git diff main..feature input.txt diff --git a/input.txt b/input.txt index 3604999..98e6387 100644 --- a/input.txt +++ b/input.txt @@ -1,2 +1,4 @@ # Lord of the rings +bilbo baggins + Now i want to see only bilbo baggins but the code i am running shows the whole difference. How can i show only the newly added lines in the console?
git diff -U0 main..feature input.txt?git diff main..feature) is semi-deprecated at this point; use the two name sequence (git diff main feature) to make sure your code works in Git 3000 or whatever version it might eventually be, released in perhaps 2035 or something. :-) These two do exactly the same thing but most people findgit diff main featureclearer, apparently.