简体   繁体   中英

SVN to GIT migration - can we ignore git-svn-id in Migrated commit messages

I have migrated one repository from svn to Git using git-svn tool. After migration, commits history include SVN mapping information as part of the commit messages. Would it be possible to exclude the git-svn-id info in the messages of migrated commits?

Commit message coming after migration - git-svn-id: https://svn-url/svn/repo-name/@163121 c3204716-b836-0410-8dec-96a83ff3a94f

We need only this part in commit message "163121 c3204716-b836-0410-8dec-96a83ff3a94f" As git-svn-id: https://svn-url/svn/repo-name/@ is added by git-svn tool while converting the repository.

Thanks in advance.

You could use git filter-branch to update all the commit messages using a command looking like this one (regex not tested):

git filter-branch -f --msg-filter "sed 's/^ git-svn-id: [^ ]+ //g'" -- --all

Then verify that all is ok and delete the folder .git/refs/original ( to delete old branches) and force push all the branches.

But that will modify all the commits sha1.

But as I said in a comment on the question, it's a long and tedious task and I don't think it worth the burden just to remove some string that won't annoy you...

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