What is Git?
Git is a distributed version control system. It tracks changes in source code during software development. Linus Torvalds (main developer of Linux) created it in 2005.
Why is Git important for developers?
- Speed & Security: It is very fast, light, and it is hard to lose data after a commit.
- Collaboration: It makes it easy for many people to work on one project together.
- Branching & Merging: You can create new branches for isolated features. Then, you can easily merge them into the main code.
- Cross Platform: Available on Windows, Linux, and MacOS. Download and Install.
Cheat Sheet: Git for Beginners
You don’t need to learn all Git commands on the internet. As a beginner, you only need the cycle: “Pack => Save => Upload”.
Here are the important commands:
1. Open the portal (Init)
When you create a new project folder, run this command. Git will start watching your folder.
git init
2. Choose files (Staging)
Before saving, choose which files to include.
Include all files (most common):
git add .
If you only want to include one file:
git add index.html
3. Save point (Commit)
This is like saving a game.
Write a clear message. This helps you understand the history later.
git commit -m "style: replace color icon to red"
4. Connect to the internet
Do this only once for your project.
This tells your local Git where to send your code (like GitHub).
git branch -M main # change to main if your branch master
git remote add origin https://github.com/username/name-repo
5. Upload your project (Push) Send your code to your GitHub repository.
git push -u origin main
Congratulations, you have secured your digital assets. Using Git is not just a trend; it is an industry standard you must master. Cmiwww:>