forked from AnsarulHaq786/Git-learn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
250 lines (247 loc) · 11.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="index.css">
<link rel="icon" href="https://th.bing.com/th?id=OIP.7MTPJSqWfwQ7fMIpVgSGrAHaHa&w=250&h=250&c=8&rs=1&qlt=90&o=6&dpr=1.3&pid=3.1&rm=2">
<title>
Learn Git
</title>
</head>
<body>
<div class="container">
<div class="other_info">
<h2>Git and Github</h2>
<h3>Git</h3>
<p>Git is a version control system that keeps track of changes in your code overtime.</p>
<h3>Github</h3>
<p>Github is the implementation of git version control. Github is a open source code contributing software
where you can publish projects code to be corrected by other users. Or simply it is the place where you
can keep track of your coding journey in a sequential manner.
</p>
</div>
<div class="git_and_github_setup">
<h3>Setup git and github</h3>
<p>
<h4>Download git bash</h4>
<a href="https://www.git-scm.com/downloads" target="_main">download</a>
<h4>Download github</h4>
<a href="https://desktop.github.com/" target="_main">download</a>
<h4>Or use github on your browser</h4>
<a href="https://github.com/" target="_main">Github-web</a>
<h5>Note: you must at least download gitbash</h5>
Sign up into github.
<a href="https://youtu.be/Gn3w1UvTx0A?si=ShBT20Y5qkSbx4h6" target="_main">Watch how to sign up</a>
</p>
</div>
<div class="git_setup_command">
<h3>Go to git bash and execute these commands</h3>
<h3>Git setup commands</h3>
<i>git config --global user.name "<-Your name->"<br>
git config --global user.email "<-Your email->"<br></i>
<i>
<h4>To check user name and email</h4>
git config --global user.name<br>
git config --global user.email<br>
</i>
</div>
<div class="repo_find">
<h3>Create and/or find your repositories?</h3>
<p>
Follow these steps:<br>
step 1: Goto your github account,<br>
step 2: Select profile in right topmost of the screen,<br>
step 3: Choose your profile<br>
step 4: Choose repository in 2nd column.<br>
step 5: Select new option.<br>
step 6: Name repository leave everything default and create.<br>
</p>
<b>Congratulations! You have made your first commit on github account.</b>
</div>
<div class="additional_info">
<p>
<br>
<b>Remote</b>: The projects or repositories which are on github account are called remote repo.<br>
<b>Local</b>: The projects which are on your computer system yet to be commited and pushed are known as
local projects.<br>
<h3>What is README.md?</h3>
README is nothing but the description about the project or anything as comparable as that.<br>
For example: We create Readme file in any repository branch to write what the project is about.<br>
At the same time we see README file in the profile of our github account where we write about ourself.<br>
<h4>Here's what they suggest you initially in README file when you're new in github</h4>
<i>
- 👋 Hi, I’m @yourid,<br>
- 👀 I’m interested in ...<br>
- 🌱 I’m currently learning ...<br>
- 💞️ I’m looking to collaborate on ...<br>
- 📫 How to reach me ...<br>
</i>
</p>
</div>
<div class="code_editor">
<h3>Code editor</h3>
<p>
It is place where we write our code. These days a<b>VS Code</b> editor is one of the most popular code
editor application. The key advantages of using visual studio code is<br>
-Variablility: We can code almost all programming as well as non programming languages in vs code
editor.<br>
-Speed: It do not lag much as compared to other code editor.<br>
-User interface: User feel comfortable while writing code in vs code.<br>
-Extensions: Vs code offers all essential extensions which programmer usually needs.<br>
<h5>Download vs code</h5>
<a href="https://code.visualstudio.com/" target="_main">download</a>
</p>
<p>
After we download vs code editor and set it up.<br>
We create folder and files in it.<br>
</p>
</div>
<div class="clone">
<h3>Clone</h3>
<p>
Clone: When we want to fetch the repository files we use clone command to clone remote repo into local
space.<br>
Clone command:<br>
<i>git clone <-https url of code section on your repository-></i>
</p>
</div>
<div class="status">
<h3>Status</h3>
<h4>To check status about</h4>
<p>
-which files are untracted<br>
-which files are to be commited<br>
-which files are modified<br>
We use this command:<br><br>
<i>git status</i>
</p>
</div>
<div class="create_new_file_and_folder">
<h3>Create</h3>
<p>
<h4>To create new folder we use</h4>
<i>mkdir <-name of directory-></i><br>
<h4>To create new file we use</h4>
<i>touch <-name of file-></i><br>
</p>
</div>
<div class="change_directory">
<h3>Directory</h3>
<p>
Directory are all the files inside your folder which are forming the tree. Say path where you are
writing
your code is <b>mypc.codes.html.learn-git</b> then these all extended folder are known as directory.
So, when you are writing another code in different file you can use this command to get access to those
codes.<br>
For now say path of that code is <b>mypc.codes.html.learn-other</b> then First we return to parent file
only after that we enter into the expected code file.<br>
<h4>To go back to parent file we use:</h4>
<i>cd ..</i>
<h4>To go into the children file we use:</h4>
<i>cd <-file_name-></i>
</p>
</div>
<div class="listing">
<h3>Listing</h3>
<p>
<h3>To list visible files we use:</h3>
<i>ls</i>
<h3>To list hidden files we use:</h3>
<i>ls -a</i>
But sometimes <i>ls -a</i> may not work because <i>-a</i> is a ambigiuous command which means it
hold more than one executive results.<br>
<h4>In that case we use:</h4>
<i>ls -force</i>
</p>
</div>
<div class="add_and_commit">
<h3>Stage and Commit</h3>
<p>
<h5>when you are done with the coding you can use these commands and steps to upload your work in github.
</h5>
<b>Step 1: Stage your file</b><br>
Staging is nothing but to save your file in local device as a file ready to commit. Think of it like
dragging your few out of many projects in code editor to the stage so that you can publish those chosen one
in open source.
<h4>Use this command to stage your file</h4>
<i>git add <-file_name-></i><br><br>
<b>Step 2: Commit your file</b><br>
When you commit your file it is almost into your remote repository. When we commit any file it means we are
done with modifying content in our project.
We take the real advantages of commit when we create different branches in repositories to use unique hash
of commited file. Each commited file has a unique hash with it.
<h4>Use this command to commit your files</h4>
<i>git commit -m "<-message for what changes you made this time in this project->"</i><br><br>
<p>Before you push your file first check this out</p><br>
<a href="remote.html" target="_main">Click Here</a><br><br>
<b>Step 3:Push committed file</b><br>
This is final step when you are working in any project. After you push your file it gets uploaded in your
github account with amazing looking green boxes in your github profile.<br>
<h4>Use this command to push your commited file</h4>
<i>git push origin main</i>
</p>
<p>Congratulations you sucessfully published your project into github account.</p>
</div>
<div class="useful_commands">
<h4>Few useful commands</h4>
<p>
<h4>To unstage the staged files we use</h4>
<i>git restore --stage <-file_name-></i>
<h4>To stage all files we use</h4>
<i>git add .</i>
<h4>To undo commits we use</h4>
<i>git reset <-commit hash-></i>
</p>
</div>
<div class="branches">
<h3>Branch</h3>
<p>
<h4>To create new branch</h4>
<i>git branch -b <-branch name-></i>
<h4>To delete any branch</h4>
<i>git branch -d <-branch name-></i>
<h4>To jump over branch</h4>
<i>git checkout <-branch name-></i>
<h4>To merge branches</h4>
<i>git merge <-brach name-></i>
When we merge braches it gets merged remotely not locally. We use pull command to fetch data from remote
access to local access.<br>
<h4>Pull commands</h4>
<i>git pull origin <-branch name-></i>
</p>
</div>
<div class="fork">
<h3>Fork</h3>
<p>
<h4>To make copy of others repository and work on it in your own</h4>
<h4>Follow these steps</h4>
<i>
-Go to github account,<br>
-Search and select repository that you want to work with,<br>
-create fork.
</i>
</p>
</div>
<div class="pull_request">
<h3>Pull request</h3>
<p>
When we make any changes to the repository of other github user. We request them to apply these changes
that we made. We must pull request in order to correct individual or companies code fault or non
satisfiable user experience.<br>
<h4>Follow these steps to pull request</h4>
<i>
-Go to your github account,<br>
-Choose the repository that you made change in,<br>
-Select the pull request option,<br>
-Write message,<br>
-Select create pull request.<br>
</i>
</p>
</div>
</div>
<address>
<hr>
<<<©Ansarul Haq>>>
<hr>
</address>
</body>
</html>