The cleanest way to validate an earlier tag for read-only purposes in Git

I have a working tree on my local machine and a remote repository. Let's say I want to quickly build an earlier version of my project on a well-known tag without breaking the current state of the working version. My tendency is to check out a separate tree that seems to be similar to this question:

Download a specific git tag

Using a clone from a remote repository, followed by verification. But the clone does a great job and removes the entire revision state. Is there an easy way to say "capture me the current state of the world in this commit / tag and merge it into this directory?" (No further version control is required - it's read-only until Git.)

Perhaps not just a check.

Thanks.

+4
source share
3 answers

If everything is local, you can do this:

mkdir /path/to/test-tree cd /path/to/repo git read-tree <tag> git checkout-index -a --prefix=/path/to/test-tree/ # don't forget the last slash # read-tree copies content into the index # to restore it: git read-tree HEAD 

Assuming you don't care about another tree that has any git info at all. If you want to, you can use the git -new-workdir script , which basically creates a clone, with the exception of populating .git with symbolic links to the original repo so that it does not take up additional disk space. This is a good approach - there is no additional disk space, and you can use one repo for development, one for testing, etc.

+5
source

Try

 git checkout -b new_branch [previous_tag] 
+1
source

It looks like you are looking for git -export: Do "git export" (for example, "svn export")?

0
source

All Articles