Reputation: 20223
using git repository, have branches v1.0 through v1.6.
like to keep latest of each version in its own directory:
/dev
/.git
/good-stuff
/v1.0
...
/v1.6
what is the best way to do this?
is there any way to recreate the snapshot when a branch is committed?
linux server. thinking of a shell script invoking git checkout
followed by rsync
to move the files. but thinking there had to be a better way.
NOTE: used "tag" when should have said "branch" - mea culpa
Upvotes: 2
Views: 155
Reputation: 58675
What you're asking for sounds idiomatic in Subversion, not Git. In Git your tree might look like so:
dev/
good-stuff/
There's also a .git/ directory under dev/ but it's really the repository itself, rather than part of your project.
You might perform some changes, commit them and tag them as v1.0, then commit further changes and tag those as v1.6. But at all times your tree will reflect the state of the project, not the collection of tags. For example:
$ git add one.o
$ git commit -m"one point oh"
$ git tag v1.0
$ git rm one.o
$ git add hex
$ git ci -m"new version coming up"
$ git tag v1.6
Now, v1.0 looks like so:
dev/
good-stuff/
one.o
and v1.6 looks like so:
dev/
good-stuff/
hex
To restore a snapshot you tagged as v1.0, check out the tag:
$ git checkout v1.0
Upvotes: 3
Reputation: 48785
Tags really aren't supposed to be updated. They're supposed to be fixed points in history. If you're making constant changes, you should use a branch for that. If you do this, there's no need to keep folders outside of git (kinda defeats the purpose of a vcs if you think about it).
If you absolutely have to have those folders though, you could probably set up a post commit hook that does that. Since you haven't listed anything about your platform, I can't go into any further details.
Upvotes: 2