Replies: 1 comment 2 replies
-
Internally, Since You could implement this and contribute it (most likely as an opt-in feature, to make it easier to accept the change). In the meantime, if you want to work around the issue, you could fake that commit yourself. Something like this should get you started: file=the/file/to/blame
tmp_index=$(git rev-parse --git-path tmp-index.$$)
cp "$(git rev-parse --git-path index)" "$tmp_index"
GIT_INDEX_FILE=$tmp_index git add "$file"
tree=$(GIT_INDEX_FILE=$tmp_index git write-tree)
mtime = $(stat -c %Y "$file") # This would be `stat -f %m "$file" on macOS
commit=$(echo "fake message" | GIT_AUTHOR_DATE=$mtime GIT_COMMITTER_DATE=$mtime git commit-tree $tree -p HEAD)
git blame $file $commit (Note: this is completely untested code, meant only for inspiration, not for mindless copy/pasting) |
Beta Was this translation helpful? Give feedback.
-
Is there any way to get Git blame to use the modified time of the file for uncommitted lines, rather than the time the blame command is run?
Beta Was this translation helpful? Give feedback.
All reactions