How to track file

hello,

ı couldn’t track my folder. What am I doing wrong ?

My folder hiearchy

Folder
-01

ı m using “dvc add Folder” comment.
then ı added to git.
git tag -a “v1” -m “message”

then ı added other file to Folder.
New data hiearchy is

Folder
-01
-02
-03

ı repeated same things.

dvc add Folder
git add Folder.dvc
git tag -a “v1.1” -m “message”

then ı check the tag v1 ı want to see just 01 file in folder but ı saw 01 02 and 03 file. Why? What am I doing wrong ?

Hi @merve !

Did you run dvc checkout after git checkout?

yes, ı forgot to mention,sorry. Also I push to git repo.
I changed my branch and tag then ı writing dvc checkout but it is not change .

When you git checkout to a different version, does the content of Folder.dvc change?

yes when ı git checkout a different version and then dvc checkout my folder.dvc is changing

And if you delete folder itself and run dvc checkout, does it restore your folder as you expect? Also, please show dvc doctor output.

when I deleted folder itself and then dvc checkout, folder is restore but it is empty :frowning:

Looks like there is some misunderstanding here. Would you be able to create a minimal reproducible example for this issue?

My folder hierarhy is comletely below.

-DATASET
-plate
-01
-images
- 1.jpg
- 2.jpg
-labels
- 1.txt
- 2.txt

then my steps;

git init
git remote add origin “”
dvc remote add -d dvcremote “”
dvc add plate
git add plate.dvc
git commit -m “plate data added.”
dvc push
git push -u origin master

then, ı have added to folder 02 under the plate folder. 02 folder hierarcy is,
-02
-images
- 1.jpg
- 2.jpg
-labels
- 1.txt
- 2.txt

then ı repeated steps.

dvc add plate
git add plate.dvc
git commit -m “plate dataset updated.”
dvc push
git push -u origin master

then, onother person want to pull the data according to commit.
he checked the commit and go to plate dataset addded commit

git checkout xxxxxx
dvc checkout

he want to see just 01 folder. Okay there is no problem.
then he checked another commit plate dataset updated.

git checkout wwwww
dvc checkout

and he saw the 01 and 02 folder. Okay, also there is no problem.

then he want to check again first plate dataset added commit

git checkout xxxxxx
dvc checkout

but he saw the 01 and 02 folders again, but he want see the just 01 folder under the plate folder. Right ?

What is the reason? what is the wrong step is here ?

Can you share the logs for the dvc checkout. As well as the existence of 02.dvc file.

when I wrote a dvc checkout ı couldnt see any log.
It occurs plate.dvc everytime, because ı tracked this plate folder. then ı checked plate.dvc files according to differents commit. these plate.dvc files are different eachother.

@merve I just tried this and indeed both directories are left in there, but plate/02/ would be empty. Can you confirm this is what you see too?

My last steps:

$ tree
.
├── plate
│   ├── 01
│   │   └── data
│   └── 02
│       └── data
└── plate.dvc
$  git checkout HEAD^
$ dvc checkout
M       plate/
$  tree
.
├── plate
│   ├── 01
│   │   └── data
│   └── 02
└── plate.dvc

TBH I’m not sure whether DVC should be removing that directory. @kupruser @isidentical ?

yes now i noticed. but why the plate/ 02 directory is not removed? This causes confusion. I shouldn’t always check if the folder is empty, right?

Hi guys,

That checkout behavior is a known bug dvc checkout will leave empty folders · Issue #2397 · iterative/dvc · GitHub

1 Like