Tell git-blame to use imported history

I have a repository which was created by copying files (not the history) from an SVN repository, with many changes added on top since.

I have since converted the history in SVN into git, and merged it with git merge -s ours.

  • How do I git blame without seeing merges
  • Why git blame does not follow renames?
  • Is there git blame gui similar to bzr qannotate?
  • Wrong result when using JGit blame
  • Is there a blame/annotate for 'MKS Source Integrity'?
  • ignore whitespace/identation in annotate mode with Intelliji and git
  • The problem is when I do a git blame on a file, it still shows every line as being created by the initial commit in the git repository (which copied all the files from SVN), rather than the SVN commit which was really responsible.

    Is there a way I can solve this without rewriting all of the git history?

  • Phpstorm superslow - 282.8% CPU usage
  • Nested Git submodules not cloning properly with --recursive flag
  • Git Commit Generation Numbers
  • Git and egit conflict about file mode 10064 although filemode is set to false
  • How to use GIT to track a slightly different version of the project?
  • How prepare simple crud java project for git
  • One Solution collect form web for “Tell git-blame to use imported history”

    You can create a replacement ref for the initial commit from git to make it
    appear to most git commands that the history which originated in git was built
    upon history imported from svn.

    You can do this with the following commands:

    git checkout -b temporary <FIRST_GIT_COMMIT>
    # Set parent of next commit to last one from svn,
    # but don't change the working tree or contents of next commit
    git reset --soft <LATEST_SVN_COMMIT>
    # Create a new commit using contents and message of the first git commit
    git commit -C <FIRST_GIT_COMMIT>
    # Tell git to use the newly created commit in place of the original git 
    # commit in most cases.
    git replace <FIRST_GIT_COMMIT> HEAD
    

    But, replacement references do not get transferred automatically with the
    standard refspecs used for remotes either when pushing or pulling. Than can be
    done manually by using:

    git push origin 'refs/replace/*:refs/replace/*'
    git pull origin 'refs/replace/*:refs/replace/*'
    

    It is not possible to have the altered history automatically transferred to
    other repositories without changing the commit ID of every commit which was
    originally created with git.

    Git Baby is a git and github fan, let's start git clone.