Hello,

After convertion of a project from CVS to git, I'd like to rename some
references in the created git repository (before it's published, so no
problems here). Is there a plumbing that would do:

git rename-ref <old_name> <new_name>

for me?

For reference, the (ugly) solution I currrently use is:

# Renamve branches/tags for brevity.
#
# e.g.: version-3-5-branch -> v3.5-branch
#

sed_cmd='sed "s/version-/v/g" | sed "s/\([0-9]\)-\([0-9]\)/\1.\2/g" | sed 
"s/\([0-9]\)-\([0-9]\)/\1.\2/g"'

if [ -f "packed-refs" ]; then
    rm -rf "packed-refs.new"
    cat "packed-refs" | eval "$sed_cmd" > "packed-refs.new" && mv 
"packed-refs.new" "packed-refs"
fi

git for-each-ref --format="%(refname)" |
while read -r; do
    ref="$REPLY"
    if [ -f "$ref" ]; then
        new_ref=`echo "$ref" | eval "$sed_cmd"`
        if [ "$ref" != "$new_ref" ]; then
            echo "$ref -> $new_ref"
            mv "$ref" "$new_ref"
        fi
    fi
done

-- Sergey.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to