Friday, 15 May 2015

How to extract different file versions between two tags in Git? -



How to extract different file versions between two tags in Git? -

methods mentioned here get list of new commits between 2 tags in git? gives me list of diff files.

however, have constraint can't checkout every time tag because need serve more 1000 request/sec asking diff files between different tags. there method available accomplish this?

for example, have 3 tags:

1.0 1.1 1.2

now assume file one.txt changes in tags , head on latest tag (1.2). when

git diff 1.0 1.1 --stat

it returns me file name one.txt know one.txt changed, , can grab file. however, one.txt on tag 1.1, need checkout first @ 1.1, otherwise latest one.txt, here need avoid checkout , one.txt on 1.1.

please suggest solution?

solution 1: git checkout

using git checkout revision specifier branch, tag, or commit sha, along filepath, checkout revision of file working copy:

git checkout <tag> -- <filepath>

note modifies version of 1 particular file. rest of working re-create not affected.

documentation

from official linux kernel documentation git log (summarized):

git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>…

when <paths> or --patch given, git checkout not switch branches. updates named paths in working tree index file or named <tree-ish> (most commit)...the <tree-ish> argument can used specify specific tree-ish (i.e. commit, tag or tree) update index given paths before updating working tree.

solution 2: git show

you can retrieve version of file using git show , outputting results file:

git show <tag>:<filepath> > <outputpath> see also

official linux kernel documentation for:

git log git show what commit-ish , tree-ish in git?

git

No comments:

Post a Comment