/    /  Git – Init

Git Init 

init1

git init is a command used in Git to initialize a new repository or to convert an existing directory into a Git repository. The git init command creates a new .git directory in the current working directory, which serves as the Git repository. This directory contains all the metadata and history of the repository, such as commits, branch information, and references to objects that represent the contents of the files in the repository.

As we can see after installing git there was no such a directory .git.

init2

After using the command git init , we could see the .git directory under the user directory.

Once the repository is initialized with git init , you can start tracking files and making commits. Before you can commit changes, you must first stage the changes using the git add command. This adds the changes to the staging area, which is a holding area for changes that are ready to be committed.

Once the changes have been staged, you can use the git commit command to save the changes to the repository. This creates a new commit object that contains a reference to the changes that have been staged and a message describing the changes.

In summary, git init is a crucial command in Git that initializes a new repository or converts an existing directory into a Git repository, allowing you to start tracking changes and committing them to the repository.