Smart Web
← Back to Web Development

Git Guide: From Installation to Project Management

Git is an open-source version control system that is indispensable for any developer. Imagine working on a large project, making changes, and then an error causes you to lose your work. With Git, you can revert to any previous version with a single click. It also allows multiple people to work on the same project without overwriting each other's work.

â„šī¸ Software Info

đŸ–Ĩī¸ OS: Windows, macOS, Linux

đŸˇī¸ Tags: Version Control, Git

💰 Price: Free

âŦ‡ī¸ Download Git

Git is available for all operating systems. You can download it from the official website:

âŦ‡ī¸ Download Git (Official)

📝 Most Important Git Commands (Detailed)

1. Initialize a New Repository (git init)

To start tracking a project with Git, go to the project folder and type:

git init

This command creates a hidden folder called `.git` that contains the entire history of your project.

2. Add Changes (git add)

When you edit a file or create a new one, you must tell Git:

git add .

The dot `.` means "add all changed files".

3. Commit Changes (git commit)

To save a snapshot of your project with a descriptive message:

git commit -m "Description of changes"

Example: git commit -m "Add homepage".

4. Push to GitHub (git push)

If you use GitHub, you can upload your code to the server:

git push origin main

5. Pull Updates from GitHub (git pull)

If a team is working with you, pull the latest updates:

git pull origin main

đŸŒŋ Branches

Branches allow you to try a new feature without affecting the main code:

git branch feature-1
git checkout feature-1

After finishing, you can merge the branch with the main branch:

git checkout main
git merge feature-1

📋 Command Summary Table

CommandFunction
git initCreate a new repository
git add .Add changes
git commit -m "..."Save changes
git pushUpload changes
git pullPull updates

❓ FAQ

Is Git free?

Yes, Git is open-source and completely free.

What is the difference between Git and GitHub?

Git is the system that manages versions on your machine. GitHub is a website for hosting your projects (a cloud version of Git).

Does Git need the internet?

No, you can use Git locally without the internet. You only need the internet when pushing to GitHub.

Have you started using Git in your projects? Share your experience in the comments!


← Back to Web Development

By: Abdulhamid Al-Bakdali

Founder of Smart Web