forked from LibraryCarpentry/lc-git
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaio.html
1895 lines (1843 loc) · 96.8 KB
/
aio.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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<!-- START: inst/pkgdown/templates/layout.html --><!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Library Carpentry: Introduction to Git: All in One View</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="assets/styles.css">
<script src="assets/scripts.js" type="text/javascript"></script><!-- mathjax --><script type="text/x-mathjax-config">
MathJax.Hub.Config({
config: ["MMLorHTML.js"],
jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML", "output/PreviewHTML"],
extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"],
TeX: {
extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
},
tex2jax: {
inlineMath: [['\\(', '\\)']],
displayMath: [ ['$$','$$'], ['\\[', '\\]'] ],
processEscapes: true
}
});
</script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><!-- Responsive Favicon for The Carpentries --><link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
</head>
<body>
<header id="top" class="navbar navbar-expand-md navbar-light bg-white top-nav library"><a class="visually-hidden-focusable skip-link" href="#main-content">Skip to main content</a>
<div class="container-fluid top-nav-container">
<div class="col-md-6">
<div class="large-logo">
<img alt="Library Carpentry" src="assets/images/library-logo.svg">
</div>
</div>
<div class="selector-container">
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle bordered-button" type="button" id="dropdownMenu1" data-bs-toggle="dropdown" aria-expanded="false">
<i aria-hidden="true" class="icon" data-feather="eye"></i> Learner View <i data-feather="chevron-down"></i>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><button class="dropdown-item" type="button" onclick="window.location.href='instructor/aio.html';">Instructor View</button></li>
</ul>
</div>
</div>
</div>
<hr></header><nav class="navbar navbar-expand-xl navbar-light bg-white bottom-nav library" aria-label="Main Navigation"><div class="container-fluid nav-container">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
<span class="menu-title">Menu</span>
</button>
<div class="nav-logo">
<img class="small-logo" alt="Library Carpentry" src="assets/images/library-logo-sm.svg">
</div>
<div class="lesson-title-md">
Library Carpentry: Introduction to Git
</div>
<div class="search-icon-sm">
<!-- TODO: do not show until we have search
<i role="img" aria-label="search button" data-feather="search"></i>
-->
</div>
<div class="desktop-nav">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<span class="lesson-title">
Library Carpentry: Introduction to Git
</span>
</li>
<li class="nav-item">
<a class="nav-link" href="key-points.html">Key Points</a>
</li>
<li class="nav-item">
<a class="nav-link" href="reference.html#glossary">Glossary</a>
</li>
<li class="nav-item">
<a class="nav-link" href="profiles.html">Learner Profiles</a>
</li>
<li class="nav-item dropdown">
<button class="nav-link dropdown-toggle" id="navbarDropdown" data-bs-toggle="dropdown" aria-expanded="false">
More <i data-feather="chevron-down"></i>
</button>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="discuss.html">Discussion</a></li>
<li><a class="dropdown-item" href="reference.html">FIXME</a></li>
</ul>
</li>
</ul>
</div>
<form class="d-flex col-md-2 search-form">
<fieldset disabled>
<input class="form-control me-2 searchbox" type="search" placeholder="Search" aria-label="Search"><button class="btn btn-outline-success tablet-search-button" type="submit">
<i class="search-icon" data-feather="search" role="img" aria-label="search button"></i>
</button>
</fieldset>
</form>
</div>
<!--/div.container-fluid -->
</nav><div class="col-md-12 mobile-title">
Library Carpentry: Introduction to Git
</div>
<aside class="col-md-12 lesson-progress"><div style="width: %" class="percentage">
%
</div>
<div class="progress library">
<div class="progress-bar library" role="progressbar" style="width: %" aria-valuenow="" aria-label="Lesson Progress" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</aside><div class="container">
<div class="row">
<!-- START: inst/pkgdown/templates/navbar.html -->
<div id="sidebar-col" class="col-lg-4">
<div id="sidebar" class="sidebar">
<nav aria-labelledby="flush-headingEleven"><button role="button" aria-label="close menu" alt="close menu" aria-expanded="true" aria-controls="sidebar" class="collapse-toggle">
<i class="search-icon" data-feather="x" role="img"></i>
</button>
<div class="sidebar-inner">
<div class="row mobile-row">
<div class="col">
<div class="sidenav-view-selector">
<div class="accordion accordion-flush" id="accordionFlush9">
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingNine">
<button class="accordion-button collapsed" id="instructor" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseNine" aria-expanded="false" aria-controls="flush-collapseNine">
<i id="eye" aria-hidden="true" class="icon" data-feather="eye"></i> Learner View
</button>
</h2>
<div id="flush-collapseNine" class="accordion-collapse collapse" aria-labelledby="flush-headingNine" data-bs-parent="#accordionFlush2">
<div class="accordion-body">
<a href="instructor/aio.html">Instructor View</a>
</div>
</div>
</div>
<!--/div.accordion-item-->
</div>
<!--/div.accordion-flush-->
</div>
<!--div.sidenav-view-selector -->
</div>
<!--/div.col -->
<hr>
</div>
<!--/div.mobile-row -->
<div class="accordion accordion-flush" id="accordionFlush11">
<div class="accordion-item">
<button id="chapters" class="accordion-button show" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseEleven" aria-expanded="false" aria-controls="flush-collapseEleven">
<h2 class="accordion-header chapters" id="flush-headingEleven">
EPISODES
</h2>
</button>
<div id="flush-collapseEleven" class="accordion-collapse show collapse" aria-labelledby="flush-headingEleven" data-bs-parent="#accordionFlush11">
<div class="accordion-body">
<div class="accordion accordion-flush" id="accordionFlush1">
<div class="accordion-item">
<div class="accordion-header" id="flush-heading1">
<a href="index.html">Summary and Setup</a>
</div>
<!--/div.accordion-header-->
</div>
<!--/div.accordion-item-->
</div>
<!--/div.accordion-flush-->
<div class="accordion accordion-flush" id="accordionFlush2">
<div class="accordion-item">
<div class="accordion-header" id="flush-heading2">
<a href="01-what-is-git.html">1. What is Git/GitHub?</a>
</div>
<!--/div.accordion-header-->
</div>
<!--/div.accordion-item-->
</div>
<!--/div.accordion-flush-->
<div class="accordion accordion-flush" id="accordionFlush3">
<div class="accordion-item">
<div class="accordion-header" id="flush-heading3">
<a href="02-getting-started.html">2. Getting started with Git</a>
</div>
<!--/div.accordion-header-->
</div>
<!--/div.accordion-item-->
</div>
<!--/div.accordion-flush-->
<div class="accordion accordion-flush" id="accordionFlush4">
<div class="accordion-item">
<div class="accordion-header" id="flush-heading4">
<a href="03-sharing.html">3. Sharing your work</a>
</div>
<!--/div.accordion-header-->
</div>
<!--/div.accordion-item-->
</div>
<!--/div.accordion-flush-->
<div class="accordion accordion-flush" id="accordionFlush5">
<div class="accordion-item">
<div class="accordion-header" id="flush-heading5">
<a href="04-review.html">4. Review</a>
</div>
<!--/div.accordion-header-->
</div>
<!--/div.accordion-item-->
</div>
<!--/div.accordion-flush-->
<div class="accordion accordion-flush" id="accordionFlush6">
<div class="accordion-item">
<div class="accordion-header" id="flush-heading6">
<a href="05-github-pages.html">5. GitHub Pages</a>
</div>
<!--/div.accordion-header-->
</div>
<!--/div.accordion-item-->
</div>
<!--/div.accordion-flush-->
</div>
</div>
</div>
<hr class="half-width">
<div class="accordion accordion-flush resources" id="accordionFlush12">
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingTwelve">
<button class="accordion-button collapsed" id="resources" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseTwelve" aria-expanded="false" aria-controls="flush-collapseTwelve">
RESOURCES
</button>
</h2>
<div id="flush-collapseTwelve" class="accordion-collapse collapse" aria-labelledby="flush-headingTwelve" data-bs-parent="#accordionFlush12">
<div class="accordion-body">
<ul>
<li>
<a href="key-points.html">Key Points</a>
</li>
<li>
<a href="reference.html#glossary">Glossary</a>
</li>
<li>
<a href="profiles.html">Learner Profiles</a>
</li>
<li><a href="discuss.html">Discussion</a></li>
<li><a href="reference.html">FIXME</a></li>
</ul>
</div>
</div>
</div>
</div>
<hr class="half-width resources">
<a href="aio.html">See all in one page</a>
<hr class="d-none d-sm-block d-md-none">
<div class="d-grid gap-1">
</div>
</div>
<!-- /div.accordion -->
</div>
<!-- /div.sidebar-inner -->
</nav>
</div>
<!-- /div.sidebar -->
</div>
<!-- /div.sidebar-col -->
<!-- END: inst/pkgdown/templates/navbar.html-->
<!-- START: inst/pkgdown/templates/content-extra.html -->
<div class="col-xl-8 col-lg-12 primary-content">
<main id="main-content" class="main-content"><div class="container lesson-content">
<section id="aio-01-what-is-git"><p>Content from <a href="01-what-is-git.html">What is Git/GitHub?</a></p>
<hr>
<p> Last updated on 2023-04-21 |
<a href="https://github.com/librarycarpentry/lc-git/edit/main/episodes/01-what-is-git.md" class="external-link">Edit this page <i aria-hidden="true" data-feather="edit"></i></a></p>
<div class="text-end">
<button role="button" aria-pressed="false" tabindex="0" id="expand-code" class="pull-right"> Expand All Solutions <i aria-hidden="true" data-feather="plus"></i></button>
</div>
<div class="overview card">
<h2 class="card-header">Overview</h2>
<div class="row g-0">
<div class="col-md-4">
<div class="card-body">
<div class="inner">
<h3 class="card-title">Questions</h3>
<ul>
<li>What is Git?</li>
<li>What is GitHub?</li>
</ul>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card-body">
<div class="inner bordered">
<h3 class="card-title">Objectives</h3>
<ul>
<li>recognize why version control is useful</li>
<li>distinguish between Git and GitHub</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<section id="what-is-version-control"><h2 class="section-heading">What is Version Control<a class="anchor" aria-label="anchor" href="#what-is-version-control"></a>
</h2>
<hr class="half-width">
<p>Version control is a name used for software which can help you record
changes you make to the files in a directory on your computer. Version
control software and tools (such as Git and Subversion/SVN) are often
associated with software development, and increasingly, they are being
used to collaborate in research and academic environments. Version
control systems work best with plain text files such as documents or
computer code, but modern version control systems can be used to track
changes in any type of file.</p>
<p>At its most basic level, version control software helps us register
and track sets of changes made to files on our computer. We can then
reason about and share those changes with others. As we build up sets of
changes over time, we begin to see some benefits.</p>
<div class="section level3">
<h3 id="benefits-of-using-version-control">Benefits of using version control?<a class="anchor" aria-label="anchor" href="#benefits-of-using-version-control"></a>
</h3>
<ul>
<li>
<strong>Collaboration</strong> - Version control allows us to define
formalized ways we can work together and share writing and code. For
example merging together sets of changes from different parties enables
co-creation of documents and software across distributed teams.</li>
<li>
<strong>Versioning</strong> - Having a robust and rigorous log of
changes to a file, without renaming files (v1, v2,
<em>final_copy</em>)</li>
<li>
<strong>Rolling Back</strong> - Version control allows us to quickly
undo a set of changes. This can be useful when new writing or new
additions to code introduce problems.</li>
<li>
<strong>Understanding</strong> - Version control can help you
understand how the code or writing came to be, who wrote or contributed
particular parts, and who you might ask to help understand it
better.</li>
<li>
<strong>Backup</strong> - While not meant to be a backup solution,
using version control systems mean that your code and writing can be
stored on multiple other computers.</li>
</ul>
<p>There are many more reasons to use version control, and we’ll explore
some of these in the library context, but first let’s learn a bit about
a popular version control tool called Git.</p>
</div>
</section><section id="what-are-git-and-github"><h2 class="section-heading">What are Git and GitHub?<a class="anchor" aria-label="anchor" href="#what-are-git-and-github"></a>
</h2>
<hr class="half-width">
<p>We often hear the terms <strong><em>Git</em></strong> and
<strong><em>GitHub</em></strong> used interchangeably but they are
slightly different things.</p>
<p><strong><em>Git</em></strong> is one of the most widely used version
control systems in the world. It is a free, open source tool that can be
downloaded to your local machine and used for logging all changes made
to a group of designated computer files (referred to as a “git
repository” or “repo” for short) over time. It can be used to control
file versions locally by you alone on your computer, but is perhaps most
powerful when employed to coordinate simultaneous work on a group of
files shared among distributed groups of people.</p>
<p>Rather than emailing documents with tracked changes and some comments
and renaming different versions of files (example.txt, exampleV2.txt,
exampleV3.txt) to differentiate them, we can use Git to save (or in Git
parlance, “commit”) all that information with the document itself. This
makes it easy to get an overview of all changes made to a file over time
by looking at a log of all the changes that have been made. And all
earlier versions of each file still remain in their original form: they
are not overwritten, should we ever wish to “roll back” to them.</p>
<p>Git was originally developed to help software developers work
collaboratively on software projects, but it can be and is used for
managing revisions to any file type on a computer system, including text
documents and spreadsheets. Once installed, interaction with Git is done
through the Command Prompt in Windows, or the Terminal on Mac/Linux.
Since Word documents contain special formatting, Git unfortunately
cannot version control those, nor can it version control PDFs, though
both file types can be stored in Git repositories.</p>
<p><em>How can understanding Git help with work in libraries?</em></p>
<ul>
<li>Enables you to contribute to, collaborate on, and support digital
research projects</li>
<li>Enables you to control changes to your files over time without
keeping multiple copies of those files</li>
</ul>
<p><strong><em>GitHub</em></strong> on the other hand is a popular
website for hosting and sharing Git repositories remotely. It offers a
web interface and provides functionality and a mixture of both free and
paid services for working with such repositories. The majority of the
content that GitHub hosts is open source software, though increasingly
it is being used for other projects such as open access journals
(e.g. <a href="https://joss.theoj.org/" class="external-link">Journal of Open Source
Software</a>), blogs, and regularly updated text books. In addition to
GitHub, there are other Git hosting services that offer many similar
features such as <a href="https://about.gitlab.com/" class="external-link">GitLab</a>, <a href="https://bitbucket.org/" class="external-link">Bitbucket</a> and <a href="https://gitee.com/" class="external-link">Gitee</a>.</p>
<p><em>How can GitHub help with work in libraries?</em></p>
<ul>
<li>A place to discover and reuse (“fork”) a huge amount of openly
licensed digital projects and open source software</li>
<li>A new and alternative means for publishing content online. Any
GitHub repository can have its own project website, blog and wiki using
GitHub Pages.</li>
</ul></section><section id="uses-in-a-library-context"><h2 class="section-heading">Uses in a Library Context<a class="anchor" aria-label="anchor" href="#uses-in-a-library-context"></a>
</h2>
<hr class="half-width">
<p>Consider these common library world scenarios:</p>
<div class="section level3">
<h3 id="scenario-1-local-library-looking-to-start-a-crowdsourcing-project">Scenario 1: Local library looking to start a crowdsourcing
project<a class="anchor" aria-label="anchor" href="#scenario-1-local-library-looking-to-start-a-crowdsourcing-project"></a>
</h3>
<p>A local librarian is looking to put thousands of historical
photographs of the area online so that the community can help identify
the people and places they depict. She combs the web for examples of
existing crowdsourcing projects, and even though they all appear unique
to each institution, she notices quite a few seem to have almost the
exact same functionality and structure. Rather than build a whole new
version from scratch herself, she wishes there was a way to just copy
the code of an existing one, and modify it to reflect her project. She
notices the <a href="https://github.com/logos" class="external-link">GitHub icon</a> at the
bottom of one of the projects she likes, but clicking on the link just
brings her to a confusing directory of files and oddly labeled buttons
such as “Fork”.</p>
<p>GitHub hosts many open-licensed projects and allows any user to fork
any public project. By clicking the “fork” button, any GitHub user can
almost instantaneously create their own version of an existing project.
That “forked” project can be used as the basis for a new project, or can
be used to work out new features that can be merged back into the
original. (From: <a href="https://hybridpedagogy.org/push-pull-fork-github-for-academics/" class="external-link">GitHub
for Academics</a> )</p>
</div>
<div class="section level3">
<h3 id="scenario-2-multiple-people-editing-metadata-for-a-collection">Scenario 2: Multiple people editing metadata for a collection<a class="anchor" aria-label="anchor" href="#scenario-2-multiple-people-editing-metadata-for-a-collection"></a>
</h3>
<p>A metadata specialist has exported a spreadsheet from a repository
for cleaning and editing. She’s working with a group of library workers
and students, so they need to make sure edits don’t conflict. They also
need to be able to undo any edits and preserve the original metadata.
Once edits are complete, the whole group wants to review the changes
before re-ingesting the spreadsheet of metadata into the repository.</p>
<p>The team can choose to use Git by itself to track changes and resolve
conflicts or they can choose to use GitHub to host the project so that
users can collaborate and review changes on the Web. Git will preserve
the original metadata as well as all edits. GitHub will facilitate
discussion about what changes should be made, who should make them, and
why.</p>
<div id="keypoints1" class="callout keypoints">
<div class="callout-square">
<i class="callout-icon" data-feather="key"></i>
</div>
<div class="callout-inner">
<h3 class="callout-title">Keypoints<a class="anchor" aria-label="anchor" href="#keypoints1"></a>
</h3>
<div class="callout-content">
<ul>
<li>Version control helps track changes to files and projects</li>
<li>Git and GitHub are not the same</li>
</ul>
</div>
</div>
</div>
</div>
</section></section><section id="aio-02-getting-started"><p>Content from <a href="02-getting-started.html">Getting started with Git</a></p>
<hr>
<p> Last updated on 2023-04-21 |
<a href="https://github.com/librarycarpentry/lc-git/edit/main/episodes/02-getting-started.md" class="external-link">Edit this page <i aria-hidden="true" data-feather="edit"></i></a></p>
<div class="text-end">
<button role="button" aria-pressed="false" tabindex="0" id="expand-code" class="pull-right"> Expand All Solutions <i aria-hidden="true" data-feather="plus"></i></button>
</div>
<div class="overview card">
<h2 class="card-header">Overview</h2>
<div class="row g-0">
<div class="col-md-4">
<div class="card-body">
<div class="inner">
<h3 class="card-title">Questions</h3>
<ul>
<li>What are repositories and how are they created?</li>
<li>What do <code>add</code> and <code>commit</code> mean?</li>
<li>How do I check the status of my repository?</li>
</ul>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card-body">
<div class="inner bordered">
<h3 class="card-title">Objectives</h3>
<ul>
<li>create a Git repository</li>
<li>track changes to files using the Git repository</li>
<li>query the current status of the Git repository</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="section level3">
<h3 id="setting-up-git">Setting up Git<a class="anchor" aria-label="anchor" href="#setting-up-git"></a>
</h3>
<p>When we use Git on a new computer for the first time, we need to
configure a few things. The basic elements of a configuration for Git
are:</p>
<ul>
<li>your name and email address,</li>
<li>what your preferred text editor is,</li>
<li>the name of your default branch (branches are an important component
of Git that we will cover later).</li>
</ul>
<p>To start we will check in on our current Git configuration. Open your
shell terminal window and type:</p>
<div class="codewrapper sourceCode" id="cb1">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git config <span class="at">--list</span></span></code></pre>
</div>
<p>On MacOS, without any configuration your output might look like
this:</p>
<div class="codewrapper">
<h3 class="code-label">OUTPUT<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="output" tabindex="0"><code><span><span class="va">credential.helper</span><span class="op">=</span><span class="va">osxkeychain</span></span></code></pre>
</div>
<p>On Windows, without any configuration your output might look like
this:</p>
<div class="codewrapper">
<h3 class="code-label">OUTPUT<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="output" tabindex="0"><code>diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager-core
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=main</code></pre>
</div>
<p>If you have different output, then you may have your Git configured
already. If you have not configured Git, we will do that together now.
First, we will tell Git our user name and email.</p>
<p>Please note: You need to use the same email address in your Git
configuration in the shell as you entered into GitHub when you created
your GitHub account. Later in the lesson we will be using GitHub and the
email addresses need to match. If you are concerned about privacy,
please review <a href="https://help.github.com/articles/keeping-your-email-address-private/" class="external-link">GitHub’s
instructions for keeping your email address private</a>.</p>
<p>Type these two commands into your shell, replacing
<code>Your Name</code> and the email address with your own:</p>
<div class="codewrapper sourceCode" id="cb4">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git config <span class="at">--global</span> user.name <span class="st">"Your Name"</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git config <span class="at">--global</span> user.email <span class="st">"[email protected]"</span></span></code></pre>
</div>
<p>If you enter the commands correctly, the shell will merely return a
command prompt and no messages. To check your work, ask Git what your
configuration is using the same command as above:</p>
<div class="codewrapper sourceCode" id="cb5">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">git</span> config <span class="at">--list</span></span></code></pre>
</div>
<div class="codewrapper">
<h3 class="code-label">OUTPUT<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="output" tabindex="0"><code>user.name=Your Name
[email protected]</code></pre>
</div>
<p>Let’s also set our default text editor. A text editor is necessary
with some of your Git work, and the default from Git is Vim, which is a
text editor that is hard to learn at first. Therefore, we recommend
setting a simpler text editor in your Git configuration for this
lesson.</p>
<div id="text-editors" class="callout callout">
<div class="callout-square">
<i class="callout-icon" data-feather="bell"></i>
</div>
<div id="text-editors" class="callout-inner">
<h3 class="callout-title">Text editors<a class="anchor" aria-label="anchor" href="#text-editors"></a>
</h3>
<div class="callout-content">
<p>There are a lot of text editors to choose from, and a lot of people
are enthusiastic about their preferences. Vi and Vim are popular editors
for users of the BASH shell. If you will be using Git or the Shell with
a group of people for a project or for work, asking for recommendations
or preferences can help you pick an editor to get started with. If you
already have your favorite, then you can set it as your default editor
with Git.</p>
</div>
</div>
</div>
<p>Any text editor can be made default by adding the correct file path
and command line options (see <a href="https://help.github.com/articles/associating-text-editors-with-git/" class="external-link">GitHub
help</a>). However, the simplest <code>core.editor</code> values are
<code>"notepad"</code> on Windows, <code>"nano -w"</code> on Mac, and
<code>"nano -w"</code> on Linux.</p>
<p>For example:</p>
<div class="codewrapper sourceCode" id="cb7">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git config <span class="at">--global</span> core.editor <span class="st">"notepad"</span></span></code></pre>
</div>
<div class="codewrapper sourceCode" id="cb8">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git config <span class="at">--global</span> core.editor <span class="st">"nano -w"</span></span></code></pre>
</div>
<p>Lastly, we need to set the name of our default branch to
<code>main.</code></p>
<div class="codewrapper sourceCode" id="cb9">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git config <span class="at">--global</span> init.defaultBranch main</span></code></pre>
</div>
<p>The <code>init.defaultBranch</code> value configures git to set the
default branch to <code>main</code> instead of <code>master</code>.</p>
</div>
<div class="section level3">
<h3 id="creating-a-repository">Creating a repository<a class="anchor" aria-label="anchor" href="#creating-a-repository"></a>
</h3>
<p>A Git <strong>repository</strong> is a data structure used to track
changes to a set of project files over time. Repositories are stored
within the same directory as these project files, in a hidden directory
called <code>.git</code>. We can create a new git repository either by
using <a href="https://github.com/new" class="external-link">GitHub’s web interface</a>, or
via the command line. Let’s use the command line to create a git
repository for the experiments that we’re going to do today.</p>
<p>First, we will create a new directory for our project and enter that
directory. We will explain commands as we go along.</p>
<div class="codewrapper sourceCode" id="cb10">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> mkdir hello-world</span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> cd hello-world</span></code></pre>
</div>
</div>
<div class="section level3">
<h3 id="using-git">Using Git<a class="anchor" aria-label="anchor" href="#using-git"></a>
</h3>
<p>One of the main barriers to getting started with Git is understanding
the terminology necessary to executing commands. Although some of the
language used in Git aligns with common-use words in English, other
terms are not so clear. The best way to learn Git terminology - which
consists of a number of verbs such as add, commit and push (preceded by
the word ‘git’) - is to use it, which is what we will be doing during
this lesson. We will explain these commands as we proceed from setting
up a new version-controlled project to publishing our own website.</p>
<p>On a command line interface, Git commands are written as
<code>git verb options</code>, where <code>verb</code> is what we
actually want to do and <code>options</code> is additional optional
information which may be needed for the <code>verb</code>. So let’s get
started with our setup.</p>
<p>We will now create an empty git repository to track changes to our
project. To do this we will use the git <strong>init</strong> command,
which is simply short for <em>initialise</em>.</p>
<div class="codewrapper sourceCode" id="cb11">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git init</span></code></pre>
</div>
<div class="codewrapper">
<h3 class="code-label">OUTPUT<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="output" tabindex="0"><code>Initialized empty Git repository in <your file path>/hello-world/.git/</code></pre>
</div>
<p>The <code>hello-world</code> directory is now a git repository.</p>
<p>If we run the <code>ls</code> command now (<code>ls</code> lists the
content of the <code>hello-world</code> directory), the repository might
seem empty; however, adding the <code>-a</code> flag for all files via
<code>ls -a</code> will show all hidden files, which in this case
includes the new hidden directory <code>.git</code>. Flags can simply be
thought of as command line options that can be added to shell
commands.</p>
<p>Note that whenever we use git via the command line, we need to
preface each command (or verb) with <code>git</code>, so that the
computer knows we are trying to get git to do something, rather than
some other program.</p>
</div>
<div class="section level3">
<h3 id="displaying-the-current-projects-status">Displaying the current project’s status<a class="anchor" aria-label="anchor" href="#displaying-the-current-projects-status"></a>
</h3>
<p>We can run the <code>git status</code> command to display the current
state of a project. Let’s do that now.</p>
<div class="codewrapper sourceCode" id="cb13">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git status</span></code></pre>
</div>
<div class="codewrapper">
<h3 class="code-label">OUTPUT<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="output" tabindex="0"><code>On branch main
No commits yet
nothing to commit (create/copy files and use "git add" to track)</code></pre>
</div>
<p>The output tells us that we are on the main branch (more on this
later) and that we have nothing to commit (no unsaved changes).</p>
</div>
<div class="section level3">
<h3 id="two-steps-adding-and-committing">Two steps: Adding and committing<a class="anchor" aria-label="anchor" href="#two-steps-adding-and-committing"></a>
</h3>
<p>We will now create and save our first project file. This is a
two-step process. First, we <strong>add</strong> any files for which we
want to save the changes to a staging area, then we
<strong>commit</strong> those changes to the repository. This two-stage
process gives us fine-grained control over what should and should not be
included in a particular commit.</p>
<p>Let’s create a new file using the <code>touch</code> command, which
is a quick way to create an empty file.</p>
<div class="codewrapper sourceCode" id="cb15">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> touch index.md</span></code></pre>
</div>
<p>The <code>.md</code> extension above signifies that we have chosen to
use the Markdown format, a lightweight markup language with plain text
formatting syntax. We will explore Markdown a bit later.</p>
<p>Let’s check the status of our project again.</p>
<div class="codewrapper sourceCode" id="cb16">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git status</span></code></pre>
</div>
<div class="codewrapper">
<h3 class="code-label">OUTPUT<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="output" tabindex="0"><code>On branch main
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
index.md
nothing added to commit but untracked files present (use "git add" to track)</code></pre>
</div>
<p>This status is telling us that git has noticed a new file in our
directory that we are not yet tracking. With colourised output, the
filename will appear in red. To change this, and to tell Git we want to
track any changes we make to index.md, we use <code>git add</code>.</p>
<div class="codewrapper sourceCode" id="cb18">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git add index.md</span></code></pre>
</div>
<p>This adds our Markdown file to the <strong>staging area</strong> (the
area where git checks for file changes). To confirm this we want to use
<code>git status</code> again.</p>
<div class="codewrapper sourceCode" id="cb19">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git status</span></code></pre>
</div>
<div class="codewrapper">
<h3 class="code-label">OUTPUT<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="output" tabindex="0"><code>On branch main
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: index.md</code></pre>
</div>
<p>If we are using colourised output, we will see that the filename has
changed colour (from red to green). Git also tells us that there is a
new file to be committed but, before we do that, let’s add some text to
the file.</p>
<p>We will open the file <code>index.md</code> with any text editor we
have at hand (e.g. Notepad on Windows or TextEdit on Mac OSX) and enter
<code># Hello, world!</code>. The hash character is one way of writing a
header with Markdown. Now, let’s save the file within the text editor
and check if Git has spotted the changes.</p>
<div class="codewrapper sourceCode" id="cb21">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git status</span></code></pre>
</div>
<div class="codewrapper">
<h3 class="code-label">OUTPUT<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="output" tabindex="0"><code>On branch main
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: index.md
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: index.md</code></pre>
</div>
<p>This lets us know that git has indeed spotted the changes to our
file, but that it hasn’t yet staged them, so let’s add the new version
of the file to the staging area.</p>
<div class="codewrapper sourceCode" id="cb23">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git add index.md</span></code></pre>
</div>
<p>Now we are ready to <strong>commit</strong> our first changes. Commit
is similar to ‘saving’ a file to Git. However, compared to saving, a
commit provides a lot more information about the changes we have made,
and this information will remain visible to us later.</p>
<div class="codewrapper sourceCode" id="cb24">
<h3 class="code-label">BASH<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="sourceCode bash" tabindex="0"><code class="sourceCode bash"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a><span class="ex">$</span> git commit <span class="at">-m</span> <span class="st">'Add index.md'</span></span></code></pre>
</div>
<div class="codewrapper">
<h3 class="code-label">OUTPUT<i aria-hidden="true" data-feather="chevron-left"></i><i aria-hidden="true" data-feather="chevron-right"></i>
</h3>
<pre class="output" tabindex="0"><code>[main (root-commit) e9e8fd3] Add index.md
1 file changed, 1 insertion(+)
create mode 100644 index.md</code></pre>
</div>
<p>We can see that one file has changed and that we made one insertion,
which was a line with the text ‘#Hello, world!’. We can also see the
commit message ‘Add index.md’, which we added by using the
<code>-m</code> flag after <code>git commit</code>. The commit message
is used to record a short, descriptive, and specific summary of what we
did to help us remember later on without having to look at the actual
changes. If we just run <code>git commit</code> without the
<code>-m</code> option, Git will launch nano (or whatever other editor
we configured as <code>core.editor</code>) so that we can write a longer
message.</p>
<p>Having made a commit, we now have a permanent record of what was
changed, and git has also recorded some additional metadata: who made
the commit (you!) and when the commit was made (timestamp). You are
building a mini-history of your process of working with the files in
this directory.</p>
<div id="more-on-the-staging-area" class="callout callout">
<div class="callout-square">
<i class="callout-icon" data-feather="bell"></i>
</div>
<div id="more-on-the-staging-area" class="callout-inner">
<h3 class="callout-title">More on the Staging Area<a class="anchor" aria-label="anchor" href="#more-on-the-staging-area"></a>
</h3>
<div class="callout-content">
<p>If you think of Git as taking snapshots of changes over the life of a
project, <code>git add</code> specifies <em>what</em> will go in a
snapshot (putting things in the staging area), and
<code>git commit</code> then <em>actually takes</em> the snapshot, and
makes a permanent record of it (as a commit). If you don’t have anything
staged when you type <code>git commit</code>, Git will prompt you to use
<code>git commit -a</code> or <code>git commit --all</code>, which is
kind of like gathering <em>everyone</em> for the picture! However, it’s
almost always better to explicitly add things to the staging area,
because you might commit changes you forgot you made. (Going back to
snapshots, you might get the extra with incomplete makeup walking on the
stage for the snapshot because you used <code>-a</code>!) Try to stage
things manually, or you might find yourself searching for “git undo
commit” more than you would like!</p>
</div>
</div>
</div>
<figure><img src="fig/git-staging-area.svg" alt="The Git Staging Area" class="figure mx-auto d-block"></figure><p>At the moment, our changes are only recorded locally, on our
computer. If we wanted to work collaboratively with someone else they
would have no way of seeing what we’ve done. We will fix that in the
next episode by using GitHub to share our work.</p>
<div id="keypoints1" class="callout keypoints">
<div class="callout-square">
<i class="callout-icon" data-feather="key"></i>
</div>
<div class="callout-inner">
<h3 class="callout-title">Keypoints<a class="anchor" aria-label="anchor" href="#keypoints1"></a>
</h3>
<div class="callout-content">
<ul>
<li>When you initialize a Git repository in a directory, Git starts
tracking the changes you make inside that directory.</li>
<li>This tracking creates a history of the way the files have changed
over time.</li>
<li>Git uses a two-step process to record changes to your files. Changes
to files must first be added to the staging area, then committed to the
Git repository.</li>
</ul>
</div>
</div>
</div>
</div></section><section id="aio-03-sharing"><p>Content from <a href="03-sharing.html">Sharing your work</a></p>
<hr>
<p> Last updated on 2023-04-21 |
<a href="https://github.com/librarycarpentry/lc-git/edit/main/episodes/03-sharing.md" class="external-link">Edit this page <i aria-hidden="true" data-feather="edit"></i></a></p>
<div class="text-end">
<button role="button" aria-pressed="false" tabindex="0" id="expand-code" class="pull-right"> Expand All Solutions <i aria-hidden="true" data-feather="plus"></i></button>
</div>
<div class="overview card">
<h2 class="card-header">Overview</h2>
<div class="row g-0">
<div class="col-md-4">
<div class="card-body">
<div class="inner">
<h3 class="card-title">Questions</h3>
<ul>
<li>How can I use Git and GitHub to share my work?</li>
<li>How do I link a local Git repository to GitHub?</li>
<li>How do I move changes between a local Git repository and a GitHub
repository?</li>
<li>How can I see the differences between my current file and my most
recent commit?</li>
</ul>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card-body">
<div class="inner bordered">
<h3 class="card-title">Objectives</h3>
<ul>
<li>create a remote repository on GitHub</li>
<li>link a local Git repository to a remote GitHub repository</li>
<li>move changes between the local and remote repositories using
<code>push</code> and <code>pull</code>
</li>
<li>examine the difference between an edited file and the file’s most
recently committed version</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<section id="the-power-of-sharing"><h2 class="section-heading">The power of sharing<a class="anchor" aria-label="anchor" href="#the-power-of-sharing"></a>
</h2>
<hr class="half-width">
<p>The real power of Git lies in being able to share your work with
others and in being able to work collaboratively. The best way to do
this is to use a remote hosting platform. For this lesson, we are using
GitHub. Let’s log in there now.</p>
</section><section id="create-a-repository-on-github"><h2 class="section-heading">Create a repository on GitHub<a class="anchor" aria-label="anchor" href="#create-a-repository-on-github"></a>
</h2>
<hr class="half-width">
<p>Once we have logged in to GitHub, we can create a new repository by
clicking the <strong>+</strong> icon in the upper-right corner of any
page then selecting <strong>New repository</strong>. Let’s do this
now.</p>
<figure><img src="fig/github-repo-new.png" alt="The GitHub website top navigation with the 'add new ...' button." class="figure mx-auto d-block"></figure><ul>
<li>Click “New Repository”</li>
</ul>
<p>Clicking <code>New Repository</code> will take you to a creation page
with different options. For this workshop, we are not using any of the
options available.</p>
<ul>
<li>Name your repository “hello-world.”</li>
</ul>
<figure><img src="fig/github-repo-new-setup_copy.png" class="image-with-shadow figure mx-auto d-block" alt="The 'create a new repository' form on GitHub"></figure><p>GitHub will ask if you want to add a README.md, license or a
<code>.gitignore</code> file. Do not do any of that for now – We want
you to start with a completely empty repository on GitHub.</p>
<ul>
<li>Click <code>Create Repository</code> button.</li>
</ul>
<div id="choosing-a-license" class="callout callout">
<div class="callout-square">
<i class="callout-icon" data-feather="bell"></i>
</div>
<div id="choosing-a-license" class="callout-inner">
<h3 class="callout-title">Choosing a license<a class="anchor" aria-label="anchor" href="#choosing-a-license"></a>
</h3>
<div class="callout-content">
<p>When you are ready to use GitHub to host your own work, you should
review the different license options. Choosing a license is an important
part of openly sharing your creative and research work online. For help
in wading through the many types of open source licenses, please visit
<a href="https://choosealicense.com/" class="external-link">https://choosealicense.com/</a>.</p>
</div>