When was this added/changed?

November 20, 2015

Use Case: Your project contains a library that wasn’t installed using CocoaPods or Carthage, and to make things worse, doesn’t contain a version number of some sort. o.O)’

Approach: Assuming you always integrate the latest version of an available library, by knowing when the library was last changed you can derive what version it must be.


Time to investigate

When was the framework file xyz last changed in the repository?1

$ git log -1 --format=%cd xyz
# Tue, 1 Sep 2015 12:02:22 +0200

OK, now we just need to look up the latest version of the framework that would have been available on the 1st of September!

Mystery solved.


Just out of curiousity, when did we start using this library in the first place…?

When was the framework file originally added to the repository? 2

$ git log --diff-filter=A --follow --format=%aD -1 -- xyz
# Tue Sep 29 15:47:02 2015 +0200

Obviously, it would make sense to alias hard-to-remember commands like these!


Sources