Git & GitHub Interview Question #9
What does git init do?
Git Fundamentals, Repository, Working Tree, Staging, Commits & Branch Basics Junior Beginner
Quick Interview Answer
git init creates a new Git repository in the current directory, or in a specified directory. It creates the .git metadata directory that Git uses to store repository history and configuration.
Detailed Explanation
git init creates a new Git repository in the current directory, or in a specified directory. It creates the .git metadata directory that Git uses to store repository history and configuration.
git init does not automatically upload anything to GitHub. A remote must be configured separately if the local repository should connect to GitHub.
Code Example
cd MyProject
git init
git status