Skip to content

Commit 97073d9

Browse files
committed
docs: vcs and github
1 parent 1dc12f7 commit 97073d9

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
### 11.5. Version Control with Git and GitHub
2+
3+
#### Overview
4+
5+
Version control is a system that records changes to a file or set of files over time, enabling you to recall specific versions later. Git is one of the most popular distributed version control systems. GitHub is a web-based platform that provides hosting for software development and a range of tools for collaboration.
6+
7+
#### Key Concepts
8+
9+
1. **Repository (Repo):** A Git repository is a collection of files and their revision history. Repositories can be local or remote.
10+
11+
2. **Commit:** A commit is a snapshot of the repository at a specific point in time. It records changes to one or more files.
12+
13+
3. **Branch:** A branch is an independent line of development. Changes made in one branch do not affect other branches until they are merged.
14+
15+
4. **Merge:** Merging combines changes from one branch into another. It's used to integrate code.
16+
17+
5. **Pull Request (PR):** A pull request is a mechanism for a developer to notify team members that they've completed a feature or fixed a bug.
18+
19+
#### Examples
20+
21+
1. **Setting Up Git:**
22+
- Install Git on your local machine.
23+
- Configure Git with your name and email.
24+
25+
```shell
26+
git config --global user.name "Your Name"
27+
git config --global user.email "your.email@example.com"
28+
```
29+
30+
2. **Creating a Repository:**
31+
- Create a new local Git repository.
32+
33+
```shell
34+
git init my-project
35+
```
36+
37+
3. **Adding and Committing:**
38+
- Add files to the staging area and commit changes.
39+
40+
```shell
41+
git add .
42+
git commit -m "Initial commit"
43+
```
44+
45+
4. **Branching:**
46+
- Create a new branch.
47+
48+
```shell
49+
git checkout -b new-feature
50+
```
51+
52+
5. **Pushing to GitHub:**
53+
- Push your local repository to GitHub.
54+
55+
```shell
56+
git remote add origin https://github.com/yourusername/my-project.git
57+
git branch -M main
58+
git push -u origin main
59+
```
60+
61+
6. **Pull Requests:**
62+
- Create a new branch, make changes, and push it to GitHub.
63+
- Create a pull request for your changes to be reviewed and merged.
64+
65+
7. **Merging and Pulling:**
66+
- Review a pull request and merge it into the main branch.
67+
68+
#### Benefits
69+
70+
- **Collaboration:** Multiple developers can work on the same project simultaneously.
71+
72+
- **History and Tracking:** Every change is tracked, providing a detailed history of the project.
73+
74+
- **Backup:** Repositories are stored both locally and remotely, ensuring that your code is safe.
75+
76+
- **Experimentation:** Developers can create branches for experimentation without affecting the main codebase.
77+
78+
- **Code Review:** Pull requests enable peer review, improving code quality.
79+
80+
In the context of the course, students will learn how to use Git and GitHub to manage their codebase efficiently. They'll understand branching strategies, collaboration workflows, and best practices for version control. These skills are fundamental for any developer and are highly sought after in the industry.

0 commit comments

Comments
 (0)