Home > Enterprise >  Smallest Git Folder Footprint in order to push tags
Smallest Git Folder Footprint in order to push tags

Time:01-01

This question is with regards to being able to create and push git tags in an Azure RELEASE pipeline. I know how to push the tags but the Azure Release pipeline doesn't work well with using both a published artifact and repo artifact so I am thinking that in the Build Pipeline I need to zip the checked out source folder Build.Repository.LocalPath and push that with my other artifacts and then unzip in the release pipeline and create/push the tags there.

I don't need all the files and history/etc of the repo, I just need enough to support this process because the source code repo with all the history is 1GB zipped.

Question: How do I get my git folder to be the smallest footprint so I can unzip it later and create the necessary tags/etc. I don't need the history or even the files I just need to be able to execute these commands:

cd %Agent_ReleaseDirectory%\_repo
git tag  mytag
git push -f --tags 

More Info. This is on a windows build agent. The build pipeline pulls down the repo and commit. I can powershell/cmd into the directory and execute any git command or delete files/etc. I just don't know what is the most efficient way to clean up this folder (compressing and publishing the artifact is already done).

CodePudding user response:

The absolute minimum clone to tag the current master branch in a remote repo as v1.1 is going to be

git clone --template= --bare --depth=1 --filter=tree:0 -b master u://r/l repo
git -C repo tag -m 'My tag' v1.1
git -C repo push origin v1.1

and the clone is going to be just ridiculously tiny, like much less than 100KB.

  • Related