Git: How to know if your directory is already under version control?
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
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”
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
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.
Recent Posts
-
The Science of Choice
-
Rolling out Enterprise Architecture
-
7 Steps to Create Processes
-
First thoughts on Prediction Machines
-
The woman I am
-
Becoming a Runner
-
Business Process Overview
-
How to link Business Rules with Business Objects
-
Analysing Open Data from the Canadian Government with Python
-
Analysis of an Infographic according to Alberto Cairo's mechanisms
-
Changing R library path
-
Shiny Application to analyse graduates per country and year
-
I don’t like boxes, do you?!
-
Need a solution to integrate a BPM and IT