In this section, you will learn how to set up a Git repository and initialize it for a new or an existing project. The points of this section will cover generating a new Git repository or initializing an existing one, copying an existing repository into a new directory, configuring a Git repository for remote collaboration, and creating short commands that map to longer ones. The commands are described below. Find detailed information about the following commands on our next pages.
The git init command is used to generate a new, empty Git repository or to initialize an existing one. With the help of this command a .git subdirectory is created, which includes the metadata, like subdirectories for objects and template files, needed for generating a new Git repository. The simplest use of git init is to set up version-controlled system projects, as there is no need to generate a repository, input files etc..
The git clone is used to create a copy of an existing repository into a new directory. Also, it is used to create remote-tracking branches for each branch in the cloned repository. It is one of the most common commands allowing users to obtain a development copy of an existing central repository.
The git config function sets configuration variables. It controls git look and operation. This command accepts arguments for specifying on which configuration level to operate. The primary use of git config is to create it with a configuration name that displays a set value at that name.
A git alias is a shortcut that creates short commands to map the longer commands. There is no direct git alias command. Aliases are created through the git config command and the git configuration files. They can be generated in a local or a global scope with other configuration values.