|
| 1 | +# 02: Git Basics |
| 2 | +This tutorial covers the fundamental concepts of Version Control Systems (VCS) and the essential Git workflow used in professional web development. |
| 3 | + |
| 4 | +## 🚀 Key Concepts |
| 5 | +Version Control System (VCS): A system that records changes to a file or set of files over time so that you can recall specific versions later. |
| 6 | + |
| 7 | +Repository (Repo): A central location where all the files for a particular project are stored, including the history of all changes made to them. |
| 8 | + |
| 9 | +Commit: A snapshot of your code at a specific point in time, acting as a "save point" in your project's history. |
| 10 | + |
| 11 | +## 🛠️ Essential Git Commands |
| 12 | +The following commands represent the core workflow for managing project versions: |
| 13 | + |
| 14 | +**git init:** Initializes a new Git repository in your current directory. |
| 15 | + |
| 16 | +**git clone [URL]:** Creates a local copy of a remote repository from GitHub. |
| 17 | + |
| 18 | +**git status:** Displays the state of the working directory and the staging area, showing which changes have been staged. |
| 19 | + |
| 20 | +**git add [file]**: Adds a change in the working directory to the staging area. |
| 21 | + |
| 22 | +**git commit -m "[message]":** Captures a snapshot of the project's currently staged changes with a descriptive message. |
| 23 | + |
| 24 | +**git push:** Sends your local branch commits to the remote repository on GitHub. |
| 25 | + |
| 26 | +## 📂 The Git Workflow |
| 27 | +Understanding the three states of Git is crucial for managing your code effectively: |
| 28 | + |
| 29 | +Working Directory: Where you do the actual work—modifying, adding, or deleting files. |
| 30 | + |
| 31 | +Staging Area (Index): A file that stores information about what will go into your next commit. |
| 32 | + |
| 33 | +Git Directory (Repository): Where Git stores the metadata and object database for your project. |
| 34 | + |
| 35 | +## 📝 Practice Exercise |
| 36 | +Create a new folder on your computer. |
| 37 | + |
| 38 | +Run git init to start tracking changes. |
| 39 | + |
| 40 | +Create a file named hello.txt and run git add hello.txt. |
| 41 | + |
| 42 | +Save your progress using git commit -m "First commit". |
0 commit comments