git merge - Convince git blame that one branch is more relevant to history than another -
i use git blame
secondary form of documentation. it's useful check why commit made, , when , whom.
but history of particular line gets lost. situations might happen:
a change made, reverted.
someone re-indents file , commits it. later standard indentation restored , committed.
someone copies files new branch/repo no history. still have original history in branch, want merge new branch.
in these cases git blame
show latest changes file, not useful. e.g. "restore indentation" or "revert commit #123" or "initial commit: files".
is there way hint git blame
more interested in older history new one?
here situation:
... - - b - c
- commit has annotations lines in file.
- commit b reindented entire file.
- commit c (possibly revert) restores file how in commit a.
i wondering if perform magical git merge priority parent:
.-------. / \ ... - - b - c - d
- commit d tells git priority history
git blame
follow.
another possibility find acceptable:
e - f \ ... - - b - c - d
- commit e new empty branch.
- commit f adds file of concern.
- commit d merges 2 histories, making f priority history.
i hoping make permanently part of history. not interested in passing options git blame
when searching history.
both of scenarios theoretically created, neither produce output desire, "change" still detected part of commit c. , both require substantial amounts of manual work there. (i'd have test happens in baseless merge, second scenario might delete other files in repo merge.)
remember git stores snapshots of code , things filenames, folders, lines, commit messages, etc. more metadata describe content inside git's brain.
git blame nature cares content of current blob , code originated. not see change between merged branch , code , keep looking commit different report.
if want eliminate whitespace changes vanilla blame give output want, best option interactive rebase squash commits under initial commit's message , author, of course assumes haven't pushed code remote , again requires manual intervention.
i know said didn't want pass options blame, easiest , consistent options pass -w
flag , blame more or less use case describes, , tell commit of last substantive (non-whitespace) change line.
Comments
Post a Comment