I have a simple git repository (origin/master branch) with a single file foo.java. In the file I have a bunch of code and a specific variable int value = 10
on line 10. The initial commit has ID x.
After 1 change and commit of the code, int value = 10
moves down to line 12, commit ID y.
After a second change and commit, the variable changes to 20 and moves down to line 13, commit ID z.
Running git log -L 13,13:foo.java
allows me to track the changes of int value
backwards through z->y->x. However this is reliant on int value
being present in the most recent commit z.
What I want to know is how to track the changes of int value
forwards, starting from the initial commit x->y->z. That way if int value
was removed from the code in a future commit, I will be able to know.
I have already tried git log -L 10,10:foo.java x..origin/master
(source: Git log -L going forward) to try track line 10 of the initial commit x forwards, but it will only look at line 10 of the latest commit z, no matter if I checkout to commit x beforehand or not.
If a 3rd commit q was added where int value
is removed, I want to be able to use git log
to see that it was introduced in commit x and changed in commits y and z before being removed in q.