We are now ready to get started, and create a repository and work with it.
There are three main ways to start a project.
Two of them presume you have no existing files to begin with, and the third when you have files in an existing folder.
- Create a folder (for the project) and initialise
- Initialise with folder (project) name
- Initialise with the existing folder and files
Use mkdir command to create the folder, change into the new folder, and then using the git init . command.
Let's presume the new project will be in the Duck-Rogers folder.
Use the pwd command to verify the folder:
You see that the Windows \ have been reversed to / and the : removed.
mkdir Duck-Rogers
cd Duck-Rogers
git init .The command prompt will now show either (master) or (main) - if it is master, we will show you later how to (a)
change it to main for the current project and (b) to make main the default.
To create the Duck-Rogers folder and initialise in a single move, we do the following:
git init Duck-Rogers
cd Duck-RogersThe best part of this is that you are basically able to use the previous options, except the folder already exists.
For example, if Duck-Rogers already exist and has files, then, if we are at the parent folder for Duck-Rogers we can
use the git init Duck-Rogers command.
If you are in the Duck-Rogers folder and there are files in the folder then using the git init . command will do the
same thing.
To check it is created we use the ls -la command:
Notice the last line. The d at the start tells you it is a folder (directory), and its name is .git. It is a hidden
folder.
All tracking of changes are then stored in the .git folder. If you delete this folder, you delete the whole history of
your project.






