Git Project Initialisation

We will learn the fundamental Git basic command to control a project folder with Git. We will start with  Git Project Initialisation

  • Create a folder for the project and name it myProject.
$ mkdir myProject
  • Create some files inside the project folder.
$ cd myProject
$ touch myfile.txt
  • Run the git init command, which initialises the current folder as a Git-controlled repository.
$ git init
  • Run the git add . command to mark the files to be version controlled. The names of the files to be added to the Git repository come after the git add command. The . means adding all files in the current directory.
$ git add .
  • Run git status to preview the commit.
$ git status
  • Run the following git commit command to commit the marked files into the repository. This step saves the changes as a snapshot.
$ git commit -m "My First commit."

Note:  Sometimes beginner, try to aviod writing the message during the commit. So they simily use -m “”. This will reject the commit from Git with the message Aborting commit due to empty commit message.”