Bishma Stornelli
Bishma Stornelli

Reputation: 2569

How to remove svn url from commit messages?

I'm trying to push a git-svn repo to github but I don't want the url to appear in my commit messages.

They appear because I'm developing with svn and only using git-svn to push to github. So all my messages looks like:

Some changes

git-svn-id: ........

Upvotes: 3

Views: 3810

Answers (2)

alfonzjanfrithz
alfonzjanfrithz

Reputation: 786

Just in case you already fetched the data using the git svn fetch you may use git filter-branch as an alternative.

git filter-branch -f --msg-filter 'sed -e "/git-svn-id:/d" -e "/Former-commit-id:/d"'

You can change the "git-svn-id:" or "Former-commit-id:" accordingly.

Upvotes: 8

Tuxdude
Tuxdude

Reputation: 49583

You could turn it off by setting the following config options (globally or per remote basis), but it is highly recommended NOT to do so, since git svn would be unable to fetch without this metadata.

svn.noMetadata = true
svn-remote.origin.noMetadata = true

You could also use the --no-metadata option with git svn clone to achieve the same result.

From the man page of git-svn:

--no-metadata

Set the noMetadata option in the [svn-remote] config. This option is not recommended, please read the svn.noMetadata section of this manpage before using this option.

And the related config file options:

svn.noMetadata

svn-remote..noMetadata

This gets rid of the git-svn-id: lines at the end of every commit.

This option can only be used for one-shot imports as git svn will not be able to fetch again without metadata. Additionally, if you lose your .git/svn/*/.rev_map. files, git svn will not be able to rebuild them.

The git svn log command will not work on repositories using this, either. Using this conflicts with the useSvmProps option for (hopefully) obvious reasons.

This option is NOT recommended as it makes it difficult to track down old references to SVN revision numbers in existing documentation, bug reports and archives. If you plan to eventually migrate from SVN to git and are certain about dropping SVN history, consider git-filter-branch(1) instead. filter-branch also allows reformatting of metadata for ease-of-reading and rewriting authorship info for non-"svn.authorsFile" users.

Upvotes: 7

Related Questions