Creating a local repository with Git CLI
Now that we have the Git binaries installed, let's take a step forward and create our first local Git repository.
Getting ready
Make sure that you have installed Git.
How to do it…
We will take a common path by starting a new pet project, where we will simply create a new local directory, add some files to it, and then realize, Ohh I am gonna need a version control system:
- So, yes, quickly create your new project:
$ mkdir mynewproject $ touch mynewproject /index.html $ touch mynewproject /main.js $ touch mynewproject/main.css
- Add some sample content to these files by editing them:
Now you need to create a Git repository for this project. Sure, Git covered you with the
git init
command. - Make sure you are in the project directory and then initialize a new repository, as follows:
$ cd mynewproject $ git init
This will initialize a new empty repository under the project directory. A new hidden directory gets created with the name .git
. This...