Say you have started working in a new project and there was no hand-over file from the previous developer. Before you start, you want to know if the a directory is under version control.

There are, of course, several options to find this out, 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

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 used to hide 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.

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”

Source Tree

4) See on the list of “Unstaged files” that files are:
– Clean
– Modified
– Missing
– 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:
– Added
– Modified
– Not tracked

Source Tree Files

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.

Source Tree Branches

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.

Source Tree Staged Files

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.