What is git blame?

In GIT, git blame is a very good option to find the person who changed a specific line. When we call git blame on a file, it displays the commit and name of a person responsible for making change in that line.

Following is a sample:

$ git blame -L 12,19 HelloWorld.java
^1822fe2 (Dave Adams 2016-03-15 10:31:28 -0700 12) public class HelloWorld {
^1822fe2 (Dave Adams 2016-03-15 10:31:28 -0700 13)
^1822fe2 (Dave Adams 2016-03-15 10:31:28 -0700 14) public static void main(String[] args) {
af6560e4 (Dave Adams 2016-03-17 21:52:20 -0700 16) // Prints “Hello, World” to the terminal window.
a9eaf55d (Dave Adams 2016-04-06 10:15:08 -0700 17) System.out.println(“Hello, World”);
af6560e4 (Dave Adams 2016-03-17 21:52:20 -0700 18) }
af6560e4 (Dave Adams 2016-03-17 21:52:20 -0700 19) }

Read the full book at www.amazon.com
Posted in GIT, GIT Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

*