There are of course several options to find out if a directory is under version control, depending on what you need, such as do it manually in command line or in your program in python, etc. For that, just Google it and you’ll find solutions, such as this one on stackOverflow.
Now, I just want to determine if my directory is under control.
First option: Go to the command line, move to your directory and type:
$ git status
The result is shows that there are no changes, thus, nothing to commit.
Note that I used
$ git status -u no
From the Git documentation, you see that -u no is not to show untracked files. I had tried before without it and it showed a long list of untracked files that did not allow me to see anything else. Since my goal here is just to see if it is under version control, that message is enough to know that it is.
Just before, you see that I tried with another folder, which is not under version control, and the error message confirms that it is not a git repository.
Second option: Using SourceTree:
1) Open to SourceTree
2) Click on “Create/New”
3) Click on “Add Working Copy”
4) See on the list of “Unstaged files” that files are:
- Not tracked
For the modified: On the right, you can see what was changed in the content.
On the top left: you can see how many files were:
- Not tracked
5) When you click on the master branch, you see that a commit was done and see all the files that were committed at the bottom and their content on the right.
Now that you are sure your directory is already under version control, you can drag and drop the files to the list of “Staged files” on top, which will be included in the next commit.
For more references, check out the Coursera Course on Data Scientist Toolbox available on github (create new repo, fork and clone a repository, git workflow, basic Git Commands) as well as this quick Git guide from the Data School and more on the data scientist’s toolbox site.