Git Topic
Creating Your First Repository
What You'll Learn:
-
Different ways to start a Git repository
-
Understanding the repository structure
-
Initial project setup best practices
Detailed Explanation:
Starting a New Project
Option 1: Initialize New Repository
# Create project directory
mkdir my-project
cd my-project
# Initialize Git repository
git init
# Check repository status
git status
Option 2: Clone Existing Repository
# Clone from remote (GitHub, GitLab, etc.)
git clone https://github.com/username/repository.git
git clone https://github.com/username/repository.git my-custom-folder
# Clone specific branch
git clone -b develop https://github.com/username/repository.git
Repository Structure
my-project/
├── .git/ # Git database (hidden folder)
│ ├── objects/ # File content storage
│ ├── refs/ # Branch and tag references
│ └── HEAD # Current branch reference
├── .gitignore # Files to ignore
└── your-files... # Project files
First Repository Workflow
# 1. Create initial files
echo "# My Project" > README.md
mkdir src
touch src/app.js
# 2. Check status
git status
# 3. Stage files
git add README.md
git add src/
# 4. Make first commit
git commit -m "Initial commit: project setup"
# 5. View history
git log
Best Practices for Initial Setup
-
Create meaningful
.gitignorefile -
Write descriptive README.md
-
Make small, focused initial commits
-
Set up remote repository early
Comments (0)
No comments yet. Be the first to comment!