Reputation: 4570
How can I view a subset of lines from a file in some previous commit. Normally I do git show HEAD:path/to/file
but if I'm only interested in a particular area of code I'd like to be able to say, e.g.git show HEAD:path/to/someFile 33-47
which would show the state of someFile
at the current HEAD for those lines only.
Upvotes: 1
Views: 34
Reputation: 9417
git show HEAD:path/to/someFile | tail -n +33 | head -n $((47-33+1))
@ElpieKay provides a cleaner solution with sed:
git show HEAD:path/to/someFile | sed -n 33,47p
Upvotes: 3