Converting Old Folder-style Versioning to Tags

We have some projects that have been tightly controlled but live on file shares.

For example:




I would like to create a git repo and import them sequentially to make each version a tag. If version1 has a file that is removed in version2, I want that reflected. Same with code changes.

How might I best achieve this?

This is a pretty standard version control exercise:

  1. Create the repository
  2. Copy version 1 into the repository
  3. Commit version 1
  4. Create a tag named version1 pointing to the latest commit
  5. Copy version 2 into the repository (and delete any files that shouldn’t be in there)
  6. Commit version 2
  7. Create a tag named version2 pointing to the latest commit
  8. etc

Keep repeating steps 5, 6, and 7 as needed until done.

I was thinking that but want an automated … or mechanized… way to layer the add/delete/change over the previous commit.

I don’t know of an automated system for doing what you’re asking. You could write a script to do it though.

Something like:

New-Item -Path $env:USERPROFILE\Documents -Name "Project" -ItemType Directory
Set-Location -Path $env:USERPROFILE\Documents\Project
git init
$Versions = Get-ChildItem C:\project | Sort-Object BaseName
foreach ( $version in $Versions) {
	Get-Item -Path $version.FullName | Copy-Item -Destination . -Recurse
	git add .
	$CommitMessage = ("Added " + $version.BaseName)
	git commit -m $CommitMessage
	Get-ChildItem | Remove-Item -Force -Recurse
$Versions | Remove-Item -Recurse -Force