CodeBlanks Logo Icon CodeBlanks

Summary - What is Git?

Combine the version control concept to explain a repository structure.

Understand the Git structure together

Git is a distributed version control system that tracks changes in project files. A repository stores commit history and branch information alongside the files. Each developer can work in a local repository and share changes with a remote repository.

Project
  ├── Working Files
  ├── .git
  │     ├── History
  │     └── Branch Data
  └── Remote Repository

This structure makes it possible to preserve history, work on different versions, and collaborate with a team.

Practice Create and share a Git repository

Initialize a new Git repository in the project directory. Stage the README.md file and create a commit with the message First project. Finally, add https://github.com/ada/project.git as origin and push the main branch.

Starter code

terminal
# Depoyu başlat

# Dosyayı kaydet

# Uzak depoyu ekle

# Ana dalı gönder

Sample solution

terminal
# Depoyu başlat
git init

# Dosyayı kaydet
git add README.md
git commit -m "İlk proje"

# Uzak depoyu ekle
git remote add origin https://github.com/ada/project.git

# Ana dalı gönder
git push -u origin main

Expected output

Initialized empty Git repository
[main (root-commit) a1b2c3d] İlk proje
 1 file changed
To https://github.com/ada/project.git
 * [new branch]      main -> main

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What is the main purpose of the .git directory in a repository?

  • To manage the remote server's operating system
  • To automatically generate HTML files
  • To store repository history and Git management data Correct answer
  • To compress all images in the project

Explanation: The .git directory stores the repository's commit history, references, and management data required by Git.

2 Define the repository structure

Question
Bir Git deposunda çalışma dosyaları ve ____ klasörü birlikte bulunur.
Answer
Bir Git deposunda çalışma dosyaları ve .git klasörü birlikte bulunur.

Explanation: The .git directory stores repository history and Git management data alongside the working files.

3 Components of a Git repository

Term Meaning
Working files Files being worked on
.git Repository management data
Local repository Repository copy on the computer
Remote repository Remote repository for sharing

All lessons in Beginner