What is the command to initialize a new Git repository?

What is the command to initialize a new Git repository?

a) git init
b) git start
c) git create
d) git begin

Answer:

a) git init

Explanation:

The git init command initializes a new Git repository in the current directory. It creates a hidden .git folder that stores the repository’s metadata, including history and configuration.

This command is used when starting a new project or converting an existing directory into a Git repository. Once the repository is initialized, you can start tracking files and committing changes.

Understanding git init is fundamental for using Git, as it is the starting point for any new repository.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top