1

This is my csv file witch contain the CommitId:

CommitId
d38f7b334856ed4007fb3ec0f8a5f7499ee2f2b8
d38f7b334856ed4007fb3ec0f8a5f7499ee2f2b8
d38f7b334856ed4007fb3ec0f8a5f7499ee2f2b8
4bb968a47ce00279d6051df95bd782650700179e
c3d7ec38417ecff03d1cd3be0163e6ce07578eb3
00568c9886e739d6b5dd61b4a4326d598552fb6f
00568c9886e739d6b5dd61b4a4326d598552fb6f
00568c9886e739d6b5dd61b4a4326d598552fb6f
00568c9886e739d6b5dd61b4a4326d598552fb6f
6e062098453febbfb0169cd0af56f70f2e3fc77f
63f658918c2f4b851b0d0fffbffab4df0cfe13ca

I need to checkout each commit and copy the version of code on another directory so for this exemple I need 11 version of code in a directory.

I tried this code for one commit:

import os
from distutils.dir_util import copy_tree
path='C:/Users/AQ42770/Desktop/RefactoringMiner/bin/BTC-e-client-for-Android'
os.chdir(path)
commande1='git chekcout  d38f7b334856ed4007fb3ec0f8a5f7499ee2f2b8'
os.system(commande1) 
copy_tree("C:/Users/AQ42770/Desktop/RefactoringMiner/bin/BTC-e-client-for-Android", "C:/Users/AQ42770/Desktop/test")

the first problem is : copy_tree() copy the files into the destination folder not the directory

Second:I did not find a way to do this for all the commits on may csv

Thanks for help!

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

2 Answers2

3

Instead of a checkout, you could use git worktree.

More precisely: git worktree add C:/Users/AQ42770/Desktop/test1 <commit1>.
And repeat for <commit2> to C:/Users/AQ42770/Desktop/test2, and so on.

That way, you have only one clone, but 11 working tree, all with the right content.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
-1

You need git cherry-pick for that.

git cherry-pick A..B where A and B are your two commits(A being the older one and B being the newer one.

Samarth Juneja
  • 766
  • 1
  • 8
  • 21