How to Create a Git Repository: git init
Master Version Control with Essential Git Commands
A Git repository contains all project files and the complete revision history, transforming an ordinary folder into a version-controlled workspace with tracking capabilities.
Git Repository Components
Project Files
Your actual code, documents, and assets that make up your project. These are the files you actively work with and modify.
Git Metadata
Hidden .git folder containing all version control information, tracking changes, branches, and commit history automatically.
Revision History
Complete timeline of all changes made to your project, allowing you to view, compare, and revert to previous versions.
Creating Your First Git Repository
Navigate to Project Folder
Open your terminal application and use cd command to navigate to the folder you want to convert into a Git repository
Execute git init Command
Run the git init command to initialize the repository and create the hidden .git subfolder with all necessary metadata
Verify Repository Creation
Check that the .git folder was created successfully, noting it may be hidden on Unix-based systems like macOS
Press Cmd-Shift-Period to toggle visibility of hidden files and folders in macOS Finder, allowing you to see the .git directory.
Before vs After git init
| Feature | Before git init | After git init |
|---|---|---|
| Folder Structure | Regular project folder | Project folder with .git subfolder |
| Version Control | No tracking capabilities | Full Git tracking enabled |
| File Visibility | All files visible | .git folder hidden by default |
| Git Commands | Commands not available | All Git commands functional |
Available Programming Courses
Web Development
Comprehensive hands-on courses covering modern web technologies with real-world applications and step-by-step workbooks for practical learning.
Python Programming
Learn Python fundamentals and advanced concepts through interactive exercises designed for students at all experience levels.
Data Science
Master data analysis, visualization, and machine learning techniques with practical projects and industry-standard tools.
Web Design
Develop creative and technical skills for modern web design with focus on user experience and visual aesthetics.
Hands-On Learning Approach
Next Steps After Learning Git
Learn branching, merging, and collaboration techniques
Build on Git knowledge with full-stack development skills
Apply version control in actual development scenarios
Choose Python, data science, or web design based on interests
Key Takeaways