Csv file created on another branch showed on main branch

Hi all! I was working on a groovy script in Katalon. I created a branch off my main local branch. My script involved csv file creation. When I finished, I staged and committed the changes that happened on the branch. Then I switched to main branch in Katalon Studio. Then I needed to switch back to the new branch I created for the new script. I could not because the csv file was present on main and was untracked. I deleted the file from main after some awkward attempts to stash or add to gitignore. Then I could switch to the new local. Question: in the future, how do I prevent csv files from showing on main while created on a diff branch?? Did anyone experience this and have a suggestion? Thanks.

1 Like

please look into doc Work with Git in Katalon Studio | Katalon Docs

Do you want the csv file to be included in the git repository? or do you want the csv file to be excluded?

Usually, we include the source code into the repository, but we exclude the artifact files that are created by other codes. In this case, the groovy script should be included in the repository while the csv file should be excluded.
Do you agree with this idea or not?


Now I assume you agree with the above mentioned principle.

As long as the csv file is excluded out of the repository, yes, the csv file will be there ---- git will not concerned about any execluded files.

In which folder do you save the csv file? I guess, you have it in the project directory, like

MyProject/Test Cases/...
MyProject/Test Suites/...
MyProject/Keywords/...
MyProject/foo.csv

It is a poor idea to save the files generated by your script in the project directory. These files will disturbe your attentions. You should create a dedicated folder where you locate all temporary files created by other scripts, like

MyProject/Test Cases/...
MyProject/Test Suites/...
MyProject/Keywords/...
MyProject/build/foo.csv

You would write in the .gitignore:

build/

This will make all files under the build directory ignored; not included in the repository.

As long as you ignore the csv files out of the repository, git will do nothing for the ignored csv file. The file will be there untouched. If you don’t want the csv file to be there, you have to delete it intentionally for yourself either manually or programatically by your script.

This question indicates that you haven’t understood the basics of git. I would recommend you to read a good book about Git and read the first few chapters. For example,

1 Like

Thanks for your detailed comments and criticism. I pretty much did what you suggested in your last comment. In regards to the project, I’m managing the code that was created by someone else. I cannot revamp the entire project structure. The csv files are stored as data files in the separate folder “Data Files” which is a part of the project. The gitgnore file is present, too. As for the git basics, my journey with git execution has been much smoother in VS Code but not in Katalon Studio. Any issues I encounter, are easily resolved in VS code.

me too. i always use git in command line.

@natallia.dyer

Have you solved your issue? Is it ok to close this discussion?

Or do you want to keep this discussion open? If yes, please describe why.