git - Determine when a line was modified in a file -


in git repository used many people, found code code i'm interested in, it's not fleshed out.

i have no way of knowing whether recent or old change, hesitate browse through commits on file.

is possible find when line of code appeared in repository can talk original person posted it?

this perfect case git blame.

as per man page

annotates each line in given file information revision last modified line. optionally, start annotating given revision.

you can use follows

git blame -- filename 

optionally (advisable, i'd say) can output result on file

git blame -- filename > blame.out 

and open file editor supporting git blame syntax. use instance sublime text 2.

other tips comments:

git gui blame -- filename 

will start basic gui interface, can helpful.

also

git blame -l 42,+1 -- filename 

will show line 42, in case interested in specific line.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -