From the course: Building Your First CLI App in Node

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Check Git repository status

Check Git repository status

From the course: Building Your First CLI App in Node

Start my 1-month free trial

Check Git repository status

- [Instructor] To finalize our work from our utility package we need to add one more piece of code to check if a Git Repository already exists. Since our utility package is handling all of the functionality around file endings and transformations, we'll also write this in files dot JS. In our files dot JS file, after the directory exists function let's create another function Is Git Repository. Be sure to add a comma after the directory exists function to chain these together. In this function we are checking if a git repository exists. So let's begin with if and send it. Files dot directory exists and then we'll pass that git. So we're using our directory exists function above to parse the file path and in this new function we're telling it to explicitly find files ending in dot git. So if any file ends in dot git that must mean a dot git repository already exists in the directory our user is currently inside of. What should we do if a git repository already exists? Let's tell our…

Contents