we plan to migrate one of our last big CVS repositories in a Git repository.
For migration we are using svn2git's cvs2git. Because this CVS repository has grown over ~ 12 years, it has 31GB of data.
I couldn't find any solution to drop all history older than a specified period of time (2 years for example).
Do you know any tool/command/resolution for one of this?:
- Drop history from the CVS
- Don't export all history with cvs2git
- Don't import all history with Git import
- Drop history from the Git
Thanks and greetings, Andreas
Solution as suggested by Dmitry Oksenchuk: After editing grafts, I wrote a BASH script tp clean up messed up tags and branches:
#!/bin/bash
NEW_ROOT_REF=$1
git tag --contains $NEW_ROOT_REF | sort > TAGS_TO_KEEP.tmp
echo "Keep Tags:"
cat TAGS_TO_KEEP.tmp | wc -w
git branch --contains $NEW_ROOT_REF | sort > BRANCHES_TO_KEEP.tmp
echo "Keep Branches:"
cat BRANCHES_TO_KEEP.tmp | wc -w
git tag -l | sort > TAGS_ALL.tmp
echo "All Tags:"
cat TAGS_ALL.tmp | wc -w
git branch -l | sort > BRANCHES_ALL.tmp
echo "All Branchess:"
cat BRANCHES_ALL.tmp | wc -w
# Remove tags
COUNTER=0
for drop in `comm TAGS_ALL.tmp TAGS_TO_KEEP.tmp -23`; do
git tag -d $drop
COUNTER=$[$COUNTER +1]
done
echo "Dropped tags: $COUNTER"
# Remove branches
COUNTER=0
for drop in `comm BRANCHES_ALL.tmp BRANCHES_TO_KEEP.tmp -23`; do
git branch -D $drop
COUNTER=$[$COUNTER +1]
done
echo "Dropped branches: $COUNTER"
# Clean up
rm TAGS_ALL.tmp TAGS_TO_KEEP.tmp BRANCHES_ALL.tmp BRANCHES_TO_KEEP.tmp