You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You will make changes in your project as usual. Once you've made a few changes you will choose ("<b>stage</b>") the changed files that belong together (for example a new feature, an edited page,
105
107
etc.) We will then <b>commit</b> these chosen ("staged") files and give all of the changes a name, e.g. <i>"Update About-Me Page"</i>.
106
108
</p>
107
-
<p>I've tried to visualize it here: <spanstyle="opacity: 0.5">(Behold my magnum opus)</span></p>
<li>The left 3 columns ("Local") represent the project on your computer.</li>
114
+
<li>The rightmost column ("Remote") represents the project on GitHub.</li>
115
+
<li>
116
+
The arrows represent commands you will use when working with git:
117
+
<ul>
118
+
<li><code>git add</code> "stages" a file (or multiple files)</li>
119
+
<li><code>git commit</code> "commits" all staged files (e.g. <i>"Update About-Me Page"</i>)</li>
120
+
<li><code>git push</code> uploads all new commits to the project on GitHub</li>
121
+
<li>
122
+
<code>git pull</code> downloads the current state of the project on GitHub to your computer. (This is not necessary if you are the only person working on your project, as there will never be
123
+
changes on GitHub that you haven't made yourself.)
<b>Pull Requests</b> (<b>PR</b> for short) are what you have to create if you want to suggest changes to <b>somebody else's</b> project. They are called pull requests because you are requesting
418
+
that they pull (= download/save) the changes you've made in their project.
419
+
</p>
420
+
<p>
421
+
If your change is really small you can make a PR on GitHub without even opening an code editor on your computer. Just open the file on GitHub that you want to change (e.g. README.md) and click the
422
+
edit button. GitHub will tell you that you need to create a <b>Fork</b> of the project. This means a copy of the entire project will be created in your GitHub Account. Once you do this, you can
423
+
edit the file and save it (commit it). Then, GitHub will tell you that you're now ready to create a pull request. Once you click the green button you can type in the PR information (title,
424
+
optional description) and post it. The whole process takes less than a minute - it's that easy!
425
+
</p>
426
+
<p>For larger changes, the process for creating a PR is as follows:</p>
427
+
<ol>
428
+
<li>Fork the repository by pressing the Fork button (a copy of the project will be created in your account)</li>
429
+
<li>Clone the repository (= download it to your computer so you can work on it, as usual)</li>
430
+
<li>Create a new branch for your change and switch into that branch. e.g. <code>git checkout -b my-change</code></li>
431
+
<li>Make your changes</li>
432
+
<li>Stage and commit your changes as usual</li>
433
+
<li>Push the changes on your branch (e.g. <code>git push origin my-change</code>)</li>
434
+
<li>Go to the repository in your account (= the fork) and you will see the green button to create a PR!</li>
435
+
</ol>
436
+
<p>Once you've created a PR, it's the project's team's job to look at your PR and either accept it (in which case your changes will be added to the project) or decline it.</p>
Branches are ways to have multiple versions of your project at once. That way, you can work on a feature (on a seperate branch), and only once it's fully done merge the branch into your main
444
+
branch.
445
+
</p>
446
+
<p>I won't be going into detail here because there a hundreds of great tutorials on git branches out there.</p>
447
+
<p>The most important commands:</p>
448
+
<ul>
449
+
<li>Show branches: <code>git branch</code></li>
450
+
<li>Switch to a branch: <code>git checkout my-branch</code></li>
451
+
<li>
452
+
Make new branch and check it out: <code>git switch -c <new-branch></code><br/>(used to be <code>git checkout -b <new-branch></code>. more info
<p>Here are some additional commands I will offer you without much context. Google them if you want to know more.</p>
463
+
<p>Here are some additional commands that can be helpful.</p>
401
464
<ul>
402
465
<li>To show all files and their current state (e.g. not staged, staged): <code>git status</code></li>
403
466
<li>To show a log of all commits: <code>git log --oneline</code> or <code>git log</code></li>
404
467
<li>To show all changes: <code>git diff</code>, or just a specific file/folder: <code>git diff <path></code></li>
405
468
<li>To discard the changes in a (not-yet-staged) file: <code>git restore <file></code> or all: <code>git restore .</code></li>
406
469
<li>To show the git version you're using: <code>git -v</code></li>
407
470
</ul>
408
-
409
-
<h4>Remotes:</h4>
410
-
<ul>
411
-
<li>Show all remotes: <code>git remote -v</code></li>
412
-
<li>Delete a remote <code>git remote remove <name></code></li>
413
-
</ul>
414
-
415
-
<h4>Branches:</h4>
416
-
<ul>
417
-
<li>Show branches: <code>git branch</code></li>
418
-
<li>
419
-
Make new branch and check it out: <code>git switch -c <new-branch></code><br/>(used to be <code>git checkout -b <new-branch></code>. more info
<ahref="https://lovesick.cafe/grrrl" aria-label="Made by a girl"><imgsrc="assets/img/links/cliques/madebyagirl.png" alt="Made by a girl" title="Made by a girl" /></a>
275
275
<br/>
276
276
<ahref="https://cliques.shadow-lord.com/cats/buttons.php" target="_blank"><imgsrc="assets/img/links/cliques/cat.png" title="I have a cat soul" alt="" /></a>
><imgwidth="50" height="50" loading="lazy" src="assets/img/links/fanlistings/wwdits.png" title="What We Do In The Shadows" alt="What We Do In The Shadows"
0 commit comments