I really hate the term “git blame”. It makes it sound like I want to blame someone for their code, when in reality I use it to see who wrote the code so I can ask them questions about it or consult them on how to best implement a feature or bug using the existing code. Anyway, that’s besides the point.
If you’re working in a team bigger than two, you will likely need to know who wrote the code you’re working on at some point so you can ask them a question if they’re still there.
When I first started working as an iOS developer, I ended up finding a the file I had a question about on Github and seeing the git blame view in there. But, as one of my co-workers showed me, there is a way to do that directly in XCode, which is a lot more convenient.
Here is how:
Simply go the “View” in the XCode navigation menu, select “Version Editor, then select “Show Blame View”. Now, on the left hand side, you’ll see the last commits line-by-line:
Once, you’re done, simply click the one-view Editor button to get back to your original coding view: