Save tags and branches with git filter-branch
If you want run git filter-branch and save refs, you must add --tag-name-filter 'cat' to your command.
For example:
I replace in repository (from file .gitmodules) git://some.host/+some/group/repo.git with git://some.host/group/repo.git and want to save tags.
My command like this:
git filter-branch --tag-name-filter 'cat' --tree-filter '
if [ -f .gitmodules ];
then
cat .gitmodules | sed -e "s/\+[a-zA-Z]*\///g" >> .tmpgitmodules && mv .tmpgitmodules .gitmodules;
else
echo "";
fi' -- --all
After run I save all refs. They was updated from old to new sha.
Written by Andrew Kumanyaev
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Branch
Authors
niklongstone
41.97K
muzzlefork
11.98K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#