├── .gitignore
├── images
├── GitHub.jpg
├── github.png
├── Git init.png
├── Git Commit.png
├── Git Status.png
├── Git track.png
├── languages.JPG
├── GitHubRepository.png
├── languages - Copie.JPG
├── octoverse-2025-top-programming-languages.webp
└── Git Diagram.svg
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/images/GitHub.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/GitHub.jpg
--------------------------------------------------------------------------------
/images/github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/github.png
--------------------------------------------------------------------------------
/images/Git init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/Git init.png
--------------------------------------------------------------------------------
/images/Git Commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/Git Commit.png
--------------------------------------------------------------------------------
/images/Git Status.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/Git Status.png
--------------------------------------------------------------------------------
/images/Git track.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/Git track.png
--------------------------------------------------------------------------------
/images/languages.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/languages.JPG
--------------------------------------------------------------------------------
/images/GitHubRepository.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/GitHubRepository.png
--------------------------------------------------------------------------------
/images/languages - Copie.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/languages - Copie.JPG
--------------------------------------------------------------------------------
/images/octoverse-2025-top-programming-languages.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ayarii/Git-GitHub-GitHubClassroom/HEAD/images/octoverse-2025-top-programming-languages.webp
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Introduction: Git and GitHub
4 | - Git is a free and open source distributed version control system.
5 | - Git is used to tracking changes in the source code and enabling multiple developers to work together.
6 | - GitHub is an online software development platform. It's used for storing, tracking, and collaborating on software projects.
7 | - In January 2022, GitHub hosted over 100 million repositories on its platform.
8 | - More than 65 million developers actively use GitHub to collaborate on open source and private projects.
9 | 
10 | ## Basic Concepts
11 | 
12 |
13 | ## 1. Installing Git
14 | First, we need to install Git: the version control software.
15 | - Git:
16 | Install [git](https://git-scm.com/downloads)
17 |
18 | ## 2. Configuring Git Account
19 | Open a terminal on your Windows or Mac and then write the following commands:
20 | 
21 |
22 | ## 3. Initialize a Local Repository
23 | 1. First, let's start by creating a folder for our project. For this you can use the GUI of Windows or Mac, use a terminal or your preferred IDE.
24 | 2. Next, cd into your project folder:
25 | ```shell
26 | cd project_name
27 | ```
28 | 3. Finally, we need to initialize the repository using the following command:
29 |
30 | ```shell
31 | git init
32 | ```
33 | 
34 |
35 |
36 | ## 4. Staging & Tracking Files
37 |
38 | ### 4.1. Adding files to the staging area
39 | 4.1.1. Create a file named _index.html_ containing a simple _\
tag_
40 | 4.1.2. Git does not know about the file _index.html_. We can check the tracked files using the following command:
41 |
42 | ```shell
43 | git status
44 | ```
45 | 4.1.3. The git status command allows you to know the status of the project: If it is initiated, modified, staged
46 | 
47 |
48 | 4.1.4. For Git to recognize this file, we need to add it to the staging area and create a commit.
49 | There are multiple ways to add files to the staging area.
50 | - Add a single file
51 | ```shell
52 | git add filename
53 | ```
54 | - Add multiple files
55 | ```shell
56 | git add filename1 filename2
57 | ```
58 | - Add multiple files and folders at once. Make sure to add a space between the add and the dot.
59 | ```shell
60 | git add .
61 | ```
62 |
63 | 
64 |
65 |
66 | 4.1.5. To remove a file from the staging area, we need to use the following command:
67 | ```shell
68 | git rm --cached filename
69 | ```
70 |
71 | ### 4.2. Commits
72 | A commit allows us to create a snapshot of the project state at that point of time. To create a commit, we use the following command with _-m_ stands for message and we list the message associated with this commit.
73 |
74 | ```shell
75 | git commit -m 'your message'
76 | ```
77 | The message should be short and accurately describes the changes made. A clear message would allow us to identify a specific commit and eventually roll back to that state if needed.
78 |
79 | 
80 |
81 | To list all commits in The Local Repository
82 | ```shell
83 | git log
84 | ```
85 | To list only latest 3 commits
86 | ```shell
87 | git log -p -2
88 | ```
89 | To go back to a specific commi
90 | ```shell
91 | git checkout commitID
92 | ```
93 | Commit types
94 | ## Commit Types
95 |
96 | | Commit Type | Title | Description | Emoji |
97 | |------------|-------------------------|------------------------------------------------------------------------------------------------------------|:------:|
98 | | `feat` | Features | A new feature | ✨ |
99 | | `fix` | Bug Fixes | A bug fix | 🐛 |
100 | | `docs` | Documentation | Documentation-only changes | 📚 |
101 | | `style` | Styles | Changes that do not affect the meaning of the code (white space, formatting, missing semicolons, etc.) | 💎 |
102 | | `refactor` | Code Refactoring | A code change that neither fixes a bug nor adds a feature | 📦 |
103 | | `perf` | Performance Improvements | A code change that improves performance | 🚀 |
104 | | `test` | Tests | Adding missing tests or correcting existing tests | 🚨 |
105 | | `build` | Builds | Changes that affect the build system or external dependencies (e.g., gulp, broccoli, npm) | 🛠 |
106 | | `ci` | Continuous Integration | Changes to CI configuration files and scripts (e.g., Travis, CircleCI, BrowserStack, SauceLabs) | ⚙️ |
107 | | `chore` | Chores | Other changes that do not modify source or test files | ♻️ |
108 | | `revert` | Reverts | Reverts a previous commit | 🔄 |
109 |
110 | ## 5. Remote
111 | First, we need to create an account GitHub.
112 | - GitHub:
113 | [gitHub](https://github.com)
114 |
115 | ### 5.1. Create a Repository
116 | 
117 | ### 5.2. Add a new remote to a local repository
118 | ```shell
119 | git remote add origin https://github.com/user/repo.git
120 | ```
121 | ### 5.3. Push to a remote repository: The git push command is used to upload local repository content to a remote repository
122 | For the first push, we need to use this commend:
123 | ```shell
124 | git push --set-upstream origin master
125 | ```
126 | - --set-upstream: The git set-upstream allows you to set the default remote branch for your current local branch
127 | - origin master: The default branch
128 |
129 | OR
130 | ```shell
131 | git push -u origin master
132 | ```
133 |
134 | ### 5.4. Pull to a local repository: The git pull command si used to fetch and download content from a remote repository and immediately update the local repository to match that content
135 | ```shell
136 | git pull
137 | ```
138 | ### 5.5 Copy an existing remote repository onto your local machine
139 | ```shell
140 | git clone URL_OF_REPO
141 | ```
142 |
143 | ## 6. Branches
144 | The branch is the copy of the main(or master) at branching instant. After branching, the branch and the master don't see each other.
145 | You can create as many branches as you want.
146 |
147 |
148 | 
149 |
150 | ### 6.1 Add a new Branch
151 | ```shell
152 | git branch branch_name
153 | ```
154 | ### 6.2 Switch to another branch
155 | ```shell
156 | git checkout branch_name
157 | ```
158 | ### 6.3 Create and checkout to the branch at the same time
159 | ```shell
160 | git checkout -b branch_name
161 | ```
162 | ### 6.4 Merge a branch to the current branch
163 | ```shell
164 | git merge branch_name
165 | ```
166 | ### 6.5 List of branches
167 | ```shell
168 | git branch
169 | ```
170 | ### 6.6 Rename Branch
171 | To rename any existing branch
172 | ```shell
173 | git branch -m
174 | ```
175 | To rename the current branch
176 | ```shell
177 | git branch -m
178 | ```
179 |
180 | ### 6.7 Delete Branch
181 | The branch must be fully merged in its upstream branch.
182 | ```shell
183 | git branch -d branch_name
184 | ```
185 | OR
186 | Use the flag -D to force the branch delete.
187 | ```shell
188 | git branch -D branch_name
189 | ```
190 |
--------------------------------------------------------------------------------
/images/Git Diagram.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------