Skip to content

Instantly share code, notes, and snippets.

@copyleftdev
Created May 25, 2026 20:21
Show Gist options
  • Select an option

  • Save copyleftdev/1c3b1ee5cb0dde55ee2999b3399543ef to your computer and use it in GitHub Desktop.

Select an option

Save copyleftdev/1c3b1ee5cb0dde55ee2999b3399543ef to your computer and use it in GitHub Desktop.
git blame -C — follow code that moved between files
# git blame -C — follow moved code across files
# Standard blame breaks when code moves. -C detects copies.
# Without copy detection — everything attributed to the refactor commit:
git blame src/freq.py
# With copy detection — attribution follows the original author:
git blame -C -C -C src/freq.py
# Three -C flags:
# -C detect copies within the same commit
# -C -C also detect copies from any commit that touched the file
# -C -C -C detect copies from any commit, across any file
# Functions that moved during a refactor now show the commit
# that *created* the logic, not the commit that moved it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment