简体   繁体   中英

How to check revision history on specific file in git

My change got dropped in one of the file in git develop branch I used below command to to check on which commit to develop branch the changes got dropped

git log -p <filename> 

but the output is not not showing clearly which commit to develop has broken it.

Two points to consider:

  • Git does not track file renames: it does not record them to the commit history, so a rename appears in a commit as a removal of the file with the old name and addition of the file with the new name.

    So if your file got renamed, you have to exercise the Git's ability to detect renames/copies at the history traversal (that's what git log does in the first place). Look at the -M and -C command-line options of git log for more info.

  • There exists lesser-known features of git log which are of immence power: the -S , -G and -L options. (Also see the accompanying --pickaxe-all and --pickaxe-regex options).

    These features allow for searching the history for the appearances or disappearances of particular bits of code, and more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM