-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.tex
2452 lines (2011 loc) · 108 KB
/
index.tex
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
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor}
%
\documentclass[
letterpaper,
DIV=11,
numbers=noendperiod]{scrreprt}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
% xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\setcounter{secnumdepth}{5}
% Make \paragraph and \subparagraph free-standing
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{241,243,245}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.40,0.45,0.13}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\BuiltInTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{\textit{#1}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{\textit{#1}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\ExtensionTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.28,0.35,0.67}{#1}}
\newcommand{\ImportTok}[1]{\textcolor[rgb]{0.00,0.46,0.62}{#1}}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\NormalTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.68,0.00,0.00}{#1}}
\newcommand{\RegionMarkerTok}[1]{\textcolor[rgb]{0.00,0.23,0.31}{#1}}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.07,0.07,0.07}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.13,0.47,0.30}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.37,0.37,0.37}{\textit{#1}}}
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\KOMAoption{captions}{tableheading}
\makeatletter
\makeatother
\makeatletter
\@ifpackageloaded{bookmark}{}{\usepackage{bookmark}}
\makeatother
\makeatletter
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\AtBeginDocument{%
\ifdefined\contentsname
\renewcommand*\contentsname{Table of contents}
\else
\newcommand\contentsname{Table of contents}
\fi
\ifdefined\listfigurename
\renewcommand*\listfigurename{List of Figures}
\else
\newcommand\listfigurename{List of Figures}
\fi
\ifdefined\listtablename
\renewcommand*\listtablename{List of Tables}
\else
\newcommand\listtablename{List of Tables}
\fi
\ifdefined\figurename
\renewcommand*\figurename{Figure}
\else
\newcommand\figurename{Figure}
\fi
\ifdefined\tablename
\renewcommand*\tablename{Table}
\else
\newcommand\tablename{Table}
\fi
}
\@ifpackageloaded{float}{}{\usepackage{float}}
\floatstyle{ruled}
\@ifundefined{c@chapter}{\newfloat{codelisting}{h}{lop}}{\newfloat{codelisting}{h}{lop}[chapter]}
\floatname{codelisting}{Listing}
\newcommand*\listoflistings{\listof{codelisting}{List of Listings}}
\makeatother
\makeatletter
\@ifpackageloaded{caption}{}{\usepackage{caption}}
\@ifpackageloaded{subcaption}{}{\usepackage{subcaption}}
\makeatother
\makeatletter
\@ifpackageloaded{tcolorbox}{}{\usepackage[skins,breakable]{tcolorbox}}
\makeatother
\makeatletter
\@ifundefined{shadecolor}{\definecolor{shadecolor}{rgb}{.97, .97, .97}}
\makeatother
\makeatletter
\makeatother
\makeatletter
\ifdefined\Shaded\renewenvironment{Shaded}{\begin{tcolorbox}[interior hidden, boxrule=0pt, enhanced, breakable, borderline west={3pt}{0pt}{shadecolor}, frame hidden, sharp corners]}{\end{tcolorbox}}\fi
\makeatother
\makeatletter
\makeatother
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same} % disable monospaced font for URLs
\hypersetup{
pdftitle={ADF\&G Division of Sport Fisheries Introduction to Git},
pdfauthor={Adam Reimer},
colorlinks=true,
linkcolor={blue},
filecolor={Maroon},
citecolor={Blue},
urlcolor={Blue},
pdfcreator={LaTeX via pandoc}}
\title{ADF\&G Division of Sport Fisheries Introduction to Git}
\author{Adam Reimer}
\date{2023-06-26}
\begin{document}
\maketitle
\renewcommand*\contentsname{Table of contents}
{
\hypersetup{linkcolor=}
\setcounter{tocdepth}{2}
\tableofcontents
}
\bookmarksetup{startatroot}
\hypertarget{preface}{%
\chapter*{Preface}\label{preface}}
\addcontentsline{toc}{chapter}{Preface}
\markboth{Preface}{Preface}
The author is aware that each analyst has a unique level of expertise
and each analysis has unique requirements. As the analyst it is up to
you to use professional judgment to decide which techniques are useful
for the analysis you are conducting. That said, we offer the following
general advice.
\begin{itemize}
\item
Best practice documents tend to describe appropriate practices for the
largest, most complex analyses you are likely to face. If you project
is simple, the overhead associated with some of these techniques may
not be justified. Use your professional judgement to discern how to
follow the spirit of reproducible research while modifing this
guidance to specific situations you encounter. The author understands
that and applies similar discretion his work.
\item
This document represent the collective experience of XX years of work
at ADF\&G. Our vision is that this guidance will be followed closely
if you have minimal prior experience. Younger employees introducing
and adopting modern research practices is one of the key ways a large
agency can keep current over time. We recognize seasoned employees
have reproducible workflows they are happy with and may be hesitant to
learn new techniques. We would encourage those employees to try some
of these techniques on new projects and to migrate existing projects
at opportune times and/or prior to transiting a project to an
different analyst.
\end{itemize}
\hypertarget{division-of-sport-fish-github-transition}{%
\section*{Division of Sport Fish Github
Transition}\label{division-of-sport-fish-github-transition}}
\addcontentsline{toc}{section}{Division of Sport Fish Github Transition}
\markright{Division of Sport Fish Github Transition}
Biometricans with ADF\&G Sport fish will be required to store their
analysis on GitHub starting in 2024. This means that all operations
plans and reports published in 2024 and later will be required to
reference a GitHub site and a specific commit where the published
analysis is stored. This decision was reached by a consensus of
Biometrican IIIs and will streamline final biometric reviews and
transitioning projects between biometrics staff. This document was
produced to help provide guidance for satisfying this requirement.
\bookmarksetup{startatroot}
\hypertarget{introduction}{%
\chapter{Introduction}\label{introduction}}
There is a a lot of git stuff out there and most of it is not intended
for scientists (one of the best science focused git tutorials for R is
\href{https://happygitwithr.com/}{HappygitwithR}). In this document our
goal to amalgamate the most common Git commands and strategies into a
workflow that is helpful for ADF\&G fisheries analysis.
\hypertarget{what-does-git-do}{%
\section{What does Git do?}\label{what-does-git-do}}
Git offers a way to track changes in your analysis without requiring the
analyst to create different versions of the same file. To use git an
analyst \textbf{init}ializes their working directory (hopefully an R
project). Files involved in the analysis (data, scripts, functions,
model code) are \textbf{add}ed so that git knows to track changes
associated with each file. When the analyst makes a \textbf{commit}, a
snapshot of all tracked files at that specific point in time are
recorded along with a message describing the commit and an automatically
assigned a unique identifier. The analyst can also \textbf{tag}
important commits. Because you can \textbf{checkout} prior commits this
system allows for traditional file versioning with a structured system
while ensuring the all commits are documented and the most important
commits are easily identifiable.
The collection of all the commits, messages, tags and identifiers
associated with a projects is called a \textbf{repository}. When a
repository is created on your computer or private/company network it is
\textbf{local}. An analyst can \textbf{push} a local repository to a
\textbf{remote} repository (stored on the cloud). Alternatively, the
analyst can \textbf{pull} a remote repository to their computer or
private/company network to either create or update a local repository.
Because multiple local repositories can push and pull to the same remote
repository Git allows collaboration between analysts while maintaining
the documentation and unique identifiers associated with each commit.
Github is the most popular hosting service facilitating these
collaborative features of Git.
\hypertarget{how-do-i-interact-with-git}{%
\section{How do I interact with Git?}\label{how-do-i-interact-with-git}}
One problem with widespread adoption of Git at ADF\&G is that there is
no accepted standard for how to interact with Git. The options are a GUI
(graphical user interface) or a command line interface (terminal).
Herein, we will focus on how to use Git while interacting through the
terminal. We make this choice for 3 reasons. First, because the terminal
is a command line interface it is easy to demonstrate the exact steps
that were taken to achieve each outcome. This presentation is more
concrete than a parade of screenshots. A second issue is that there are
a lot of GUIs out there. I will include an appendix which shows how to
do the most common Git functions in RStudio. While not a particuarly
good Git GUI the RStudio interface is sufficient for most tasks and
readily available for most readers of this book. If you have a GUI you
highly recommend we welcome your input. Please fork the repository
associated with this book, add an appendix with instructions for your
prefered GUI and submit a pull request\ldots{} instructions on how to do
so are included in the chapter on collaboration. A final reason to use
command line in the context of this book is that the terminal commands
are commonly described in Stack Overflow if you Google how to accomplish
a task in Git. Rest assured, I don't use the terminal to interact with
Git the majority of the time\footnote{I generally use the RStudio GUI
first, the terminal when the RStudio GUI is not sufficient and Git
Kraken when I have a lot of branches to visualize/review.} and I don't
recommend you do either. But I do think you will end up there
eventually, that the terminal has pedagogical advantages and that if you
can use the terminal the GUI's are easier to understand.
In order to use the terminal effectively it helps to make one change to
the Rstudio defaults by executing the following point and click
commands: \emph{Tools\textgreater Terminal\textgreater Terminal
Options\ldots\textgreater(change initial directory to `project
directory')}. This change will ensure your terminal opens in the correct
directory and save some unnecessary terminal commands.
\hypertarget{conventions-used-in-this-book}{%
\section{Conventions used in this
book}\label{conventions-used-in-this-book}}
Throughout this document you will find code blocks which show the
command line prompt, the command given, and the result received for each
action demonstrated. Code blocks are identifiable by a grey bar along
the left hand margin. In the terminal, each command line prompt (\$) is
proceeded by the username, shell type, and directory location. In the
terminal session below we can see that the username was
amreimer@DFGSXQDSF206801, the shell type was MING64 and the directory
location was S:/RTS/Reimer/Research\_Best\_Practices/git\_practice.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{amreimer@DFGSXQDSF206801 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice}
\NormalTok{$}
\end{Highlighting}
\end{Shaded}
When point and click sequences are referenced in this text button names
will be shown in \emph{italic}, button names in series will be separated
by and the greater than symbol (\textgreater) and any actions required
will be described using (\emph{italics} \emph{enclosed in parenthesis}).
For an example see the last paragraph of the preceding section.
When git commands are referenced in the text they will be displayed as
an \texttt{inline\ code\ block}. R objects and Git branches are also
referenced as \texttt{inline\ code\ blocks}.
\bookmarksetup{startatroot}
\hypertarget{the-basic-git-workflow}{%
\chapter{The Basic Git Workflow}\label{the-basic-git-workflow}}
Basic Git use includes how to create a repository, track changes in the
files within your repository, view your repository history, and view
line by line changes in modified files. The title for each section in
this chapter will be a basic Git command with the text, code blocks, and
figures in each section describing the use and result for each command.
\hypertarget{git-init}{%
\subsection{git init}\label{git-init}}
If you have an empty folder that you would like make a git repository
\texttt{git\ init} is the appropriate command. In the example below I
have an empty folder named ``git\_practice'' on S drive under
S:/RTS/Reimer/Research\_best\_practices. The terminal session below
shows 3 commands and the output received after each command: 1) verify
the directory is not a git repository with \texttt{git\ status}, 2) make
it a git repository with \texttt{git\ init}, 3) verify the directory is
now a git repository with \texttt{git\ status}.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice}
\NormalTok{$ git status}
\NormalTok{fatal: not a git repository (or any of the parent directories): .git}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice}
\NormalTok{$ git init}
\NormalTok{Initialized empty Git repository in //dfg.alaska.local/DSF/Anchorage/RTS/Reimer/Research\_Best\_Practices/git\_practice/.git/}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git status}
\NormalTok{On branch \{main\}}
\NormalTok{No commits yet}
\NormalTok{Untracked files:}
\NormalTok{ (use "git add \textless{}file\textgreater{}..." to include in what will be committed)}
\NormalTok{ .gitignore}
\NormalTok{ git\_practice.Rproj}
\NormalTok{nothing added to commit but untracked files present (use "git add" to track)}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$}
\end{Highlighting}
\end{Shaded}
The \texttt{git\ init} command creates a git repository in your project
directory. At this point, the repository is nearly empty but the git
workflow has been enabled which will allow us to commit to the
repository in the future. The rounded rectangle in Figure~\ref{fig-init}
indicates the contents of your working directory at this point in time.
At the moment they are represented by an empty rectangle which indicates
that the files in your working directory are in a Git work space. We
will build this figure as we complete tasks within the Git work space.
\begin{figure}
{\centering \includegraphics{basics_files/figure-pdf/fig-init-1.pdf}
}
\caption{\label{fig-init}The Git workspace after you have initilized a
repository.}
\end{figure}
\hypertarget{git-add}{%
\subsection{git add}\label{git-add}}
In the last git status report shown above 2 files (\texttt{.gitignore}
and \texttt{git\_practice.Rproj)} were noted that could be added to the
repository. Before we do that let's create third file named fib\_seq.R
which contains a brief header and a single line of code
\texttt{fib\_seq\ \textless{}-\ c(0,\ 1)}. The Fibonacci sequence is the
sequence created when each value in the sequence is the sum of the 2
previous values in the sequence and the vector \texttt{c(0,\ 1)}
initializes the sequence. We will add to this sequence to practice the
use of Git. The terminal session below shows 5 commands: 1) view which
files need to be added with \texttt{git\ status}, 2) add each file one
at a time with \texttt{git\ add}, 3) verify all files have been added
with \texttt{git\ status}. Notice that I made a typo while attempting to
add the \texttt{git\_practice.Rproj} file. I survived this catastrophe
with a warning, which is typical of mistakes in the terminal.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{$ git status}
\NormalTok{On branch \{main\}}
\NormalTok{No commits yet}
\NormalTok{Untracked files:}
\NormalTok{ (use "git add \textless{}file\textgreater{}..." to include in what will be committed)}
\NormalTok{ .gitignore}
\NormalTok{ fib\_seq.R}
\NormalTok{ git\_practice.Rproj}
\NormalTok{nothing added to commit but untracked files present (use "git add" to track)}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git add .gitignore}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git add fib\_seq.R}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git\_add git\_practice.Rproj}
\NormalTok{bash: git\_add: command not found}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git add git\_practice.Rproj}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git status}
\NormalTok{On branch \{main\}}
\NormalTok{No commits yet}
\NormalTok{Changes to be committed:}
\NormalTok{ (use "git rm {-}{-}cached \textless{}file\textgreater{}..." to unstage)}
\NormalTok{ new file: .gitignore}
\NormalTok{ new file: fib\_seq.R}
\NormalTok{ new file: git\_practice.Rproj}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$}
\end{Highlighting}
\end{Shaded}
Use of \texttt{git\ add} stages files you would like to track in your
git repository. The rectangle in Figure~\ref{fig-add} is now filled
which indicates that files within your working directory are staged and
ready to be committed.
\begin{figure}
{\centering \includegraphics{basics_files/figure-pdf/fig-add-1.pdf}
}
\caption{\label{fig-add}The Git workspace after you have staged files in
your working directory which you intend to add to your local
repository.}
\end{figure}
Notice Git tells you how to unstage a file if you added one
inadvertently. On occasion there are files in your working directory
which you do not want Git to track. Examples might be .pdf files for
literature you referenced while conducting the analysis, word documents
you produced for operational planning and reporting, or extremely large
outputs. It's fine to exclude these sort of files but before you do so
consider\ldots{} ``Would a future researcher need access to this file to
recreate my work?''. If they would you should track them in the
repository.
It can be cumbersome to have a long list of files which Git recognizes
as present in your working directory but you are not actively tracking.
The solution is to open the file .gitignore and include the names of the
files you do not want to track. You can use wildcards if you prefer not
to track all files of a certain type and/or specify folders if you don't
want to track anything in certain sub-directories. For example,
\texttt{*.xlsx} would ignore all .xlsx files in your working directory
while \texttt{posts/} would ignore all of the files in the folder posts
within your working directory.
\hypertarget{git-commit}{%
\subsection{git commit}\label{git-commit}}
In the \texttt{git\ status} response above 3 files were staged. Let's
commit those files in the terminal. In the terminal session below we
verify all of the files we want to commit were staged using
\texttt{git\ status}, recorded (committed) all of the staged files into
the repository using \texttt{git\ commit}, verified the commit worked
using \texttt{git\ status} and examined the repository log using
\texttt{git\ log}.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git status}
\NormalTok{On branch \{main\}}
\NormalTok{No commits yet}
\NormalTok{Changes to be committed:}
\NormalTok{ (use "git rm {-}{-}cached \textless{}file\textgreater{}..." to unstage)}
\NormalTok{ new file: .gitignore}
\NormalTok{ new file: fib\_seq.R}
\NormalTok{ new file: git\_practice.Rproj}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git commit {-}m "Initialize Fibonacci sequence" {-}m "Sequential additions to the Fibonacci sequence will provide a simple way to demonstrate several cycles of the git workflow including add/commit, push/pull, collaborate, fork, branch, merge, merge conflicts, exc. I even got my wife a GitHub account for this. Wish us luck!"}
\NormalTok{[\{main\} e17181f] Initialize Fibonacci sequence}
\NormalTok{ Date: Sun Jul 2 12:59:06 2023 {-}0800}
\NormalTok{ 3 files changed, 21 insertions(+)}
\NormalTok{ create mode 100644 .gitignore}
\NormalTok{ create mode 100644 fib\_seq.R}
\NormalTok{ create mode 100644 git\_practice.Rproj}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git status}
\NormalTok{On branch \{main\}}
\NormalTok{nothing to commit, working tree clean}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git log}
\NormalTok{commit e17181fa781b2e30096e1c7d31443aac18d527e5 (HEAD {-}\textgreater{} \{main\})}
\NormalTok{Author: Adam Reimer \textless{}adam.reimer@alaska.gov\textgreater{}}
\NormalTok{Date: Sun Jul 2 12:59:06 2023 {-}0800}
\NormalTok{ Initialize Fibonacci sequence}
\NormalTok{ Sequential additions to the Fibonacci sequence will provide a simple way to demonstrate several cycles of the git workflow including add/commit, push/pull, collaborate, fork, branch, merge, merge conflicts, exc. I even got my wife a GitHub account for this. Wish us luck!}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$}
\end{Highlighting}
\end{Shaded}
The \texttt{git\ log} command provides a summary of the commit. Two
important parts are the commit ID and the commit message. The commit ID
is a code which can be used to reference the commit in the future. Git
assigned a long ID to each commit
(\texttt{e17181fa781b2e30096e1c7d31443aac18d527e5} for this commit) but
its common to using only the first 7 characters of the commit ID
(\texttt{e17181f)} to refer to the commit.
Commit messages are required. Notice the commit message is broken into 2
parts. The first part is called the title or summary while the second
part is called the description. A good practice is for the title to be
brief (less that 50 characters) so that it displays well in most
formats. There is no length limit for the description and this is the
place to provide some explanation beyond what you can capture in the
title. I've purposely been verbose with the commit above to demonstrate
a long description.
\begin{figure}
{\centering \includegraphics{basics_files/figure-pdf/fig-push-1.pdf}
}
\caption{\label{fig-push}The Git workspace after you have committed your
staged files to your local repository.}
\end{figure}
The git workflow described so far forms the basis on reproducible
research using Git. We will calculate the next several values in the
Fibonacci sequence to practice this workflow. The same sqence described
above is repeated:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
A change is made to \texttt{fib\_seq.R} (in this case a new line
\texttt{fib\_seq{[}3{]}\ \textless{}-\ fib\_seq{[}1{]}\ +\ fib\_seq{[}2{]}}
is added) and saved to the working directory. Te working directory now
represents a more recent snapshot of time that the local repository.
\item
The changed file is staged.
\item
The staged file is committed.
\item
Repeat steps 1 through 3.
\end{enumerate}
The process looks like:
\begin{figure}
\begin{minipage}[t]{0.50\linewidth}
{\centering
\includegraphics{basics_files/figure-pdf/unnamed-chunk-7-1.pdf}
}
\end{minipage}%
%
\begin{minipage}[t]{0.50\linewidth}
{\centering
\includegraphics{basics_files/figure-pdf/unnamed-chunk-8-1.pdf}
}
\end{minipage}%
\newline
\begin{minipage}[t]{0.50\linewidth}
{\centering
\includegraphics{basics_files/figure-pdf/unnamed-chunk-9-1.pdf}
}
\end{minipage}%
%
\begin{minipage}[t]{0.50\linewidth}
{\centering
\includegraphics{basics_files/figure-pdf/unnamed-chunk-10-1.pdf}
}
\end{minipage}%
\end{figure}
\hypertarget{when-to-commit}{%
\subsubsection{When to Commit?}\label{when-to-commit}}
Saves and a commits serve different purposes. As we all know, save can
and should be used frequently\ldots{} many times an hour and/or any time
you are stepping away from your work. This use is agnostic to whether
the analyst is or is not using a git workflow.
In contrast, commits are made for two reasons. First, a commit should be
made whenever the analysis is at a point which you may want to revisit.
Examples include; adding new data, adding a new feature to the analysis,
or any time the code was run and the results were distributed. Any one
of these tasks may have resulted in a new `version' in the traditional
workflow but they don't have to be major updates. A second reason to
commit is when the changes are substantive enough that the line-by-line
change may be difficult to track if you did not commit until the new
data/feature are complete. These commits snapshot significant steps in a
new feature's development or prior to experimenting with a new feature.
The most important thing to note regarding commits is that, unlike save,
there is no temporal component. While saves are designed to minimize the
risk of lost work and should be frequent \emph{in time}, commits are
designed to record importance stages of the analysis and should be
frequent \emph{with respect to progress}. A difficult feature may take
days to code but represent a single commit, provided the actual changes
to the code are modest. Efficiency in commit frequency will pay off when
the repository is being revisited at a later date and each commit is a
snapshot of the analysis that is important or informative to the
reviewer.
\hypertarget{git-log}{%
\subsection{git log}\label{git-log}}
To view our commit history in the terminal use \texttt{git\ log}. Note
that the commit ID, author, date, commit title and commit description
are all shown in the log.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git log}
\NormalTok{commit 11cf98ff67b8ec4f8cd7f2c1650a176d5875fdcf (HEAD {-}\textgreater{} \{main\})}
\NormalTok{Author: Adam Reimer \textless{}adam.reimer@alaska.gov\textgreater{}}
\NormalTok{Date: Sun Jul 2 14:53:05 2023 {-}0800}
\NormalTok{ Fourth entry in the Fibonacci sequence}
\NormalTok{ Long and informative message goes here.}
\NormalTok{commit 3bb6c98bb0048bad7bda489bd8d40be24fb66acf}
\NormalTok{Author: Adam Reimer \textless{}adam.reimer@alaska.gov\textgreater{}}
\NormalTok{Date: Sun Jul 2 14:31:04 2023 {-}0800}
\NormalTok{ Third entry in fib\_seq}
\NormalTok{ This message is not necessary for such a simple commit, but descriptions are an important part of reproducible research I’m writing a long message to set a good example. Have better content in yours.}
\NormalTok{commit e17181fa781b2e30096e1c7d31443aac18d527e5}
\NormalTok{Author: Adam Reimer \textless{}adam.reimer@alaska.gov\textgreater{}}
\NormalTok{Date: Sun Jul 2 12:59:06 2023 {-}0800}
\NormalTok{ Initialize Fibonacci sequence}
\NormalTok{ Sequential additions to the Fibonacci sequence will provide a simple way to demonstrate several cycles of the git workflow including add/commit, push/pull, collaborate, fork, branch, merge, merge conflicts, exc. I even got my wife a GitHub account}
\NormalTok{for this. Wish us luck!}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$}
\end{Highlighting}
\end{Shaded}
\hypertarget{git-diff}{%
\subsection{git diff}\label{git-diff}}
To see the difference between two commits use \texttt{git\ diff}. With
no additional arguments \texttt{git\ diff} will show the changes in the
working directory relative to the last commit. Our working directory has
no changes as illustrated by \texttt{git\ status}. Instead we can add a
short commit ID to the command to see changed between the current
working directory and the commit \texttt{3bb6c9}.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git status}
\NormalTok{On branch \{main\}}
\NormalTok{nothing to commit, working tree clean}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git diff 3bb6c9}
\NormalTok{diff {-}{-}git a/fib\_seq.R b/fib\_seq.R}
\NormalTok{index 9c118d5..4ce1d70 100644}
\NormalTok{{-}{-}{-} a/fib\_seq.R}
\NormalTok{+++ b/fib\_seq.R}
\NormalTok{@@ {-}2,4 +2,5 @@}
\NormalTok{ \#Adam Reimer}
\NormalTok{ fib\_seq \textless{}{-} c(0, 1)}
\NormalTok{{-}fib\_seq[3] \textless{}{-} fib\_seq[1] + fib\_seq[2]}
\NormalTok{\textbackslash{} No newline at end of file}
\NormalTok{+fib\_seq[3] \textless{}{-} fib\_seq[1] + fib\_seq[2]}
\NormalTok{+fib\_seq[4] \textless{}{-} fib\_seq[2] + fib\_seq[3]}
\NormalTok{\textbackslash{} No newline at end of file}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$}
\end{Highlighting}
\end{Shaded}
Git GUI's are superior to the terminal when looking at line-by line
differences but for completeness we will discuss how to read the output.
The section \texttt{-\/-\/-\ a/fib\_seq.R} to \texttt{+++\ b/fib\_seq.R}
identifies the files that were modified where \texttt{-\/-\/-\ a/} and
\texttt{+++\ b} refer to the previous and the current versions of the
file respectively. The line \texttt{@@\ -2,4\ +2,5\ @@} tells us that
the output is showing the original file starting on the second line and
displaying the the next 4 lines (three unmarked lines and the line with
a negative symbol) while the new version of the file is also shown
starting from the second line but displaying the next 5 lines (the three
unmarked lines and the two lines with an addition symbol). This makes
sense because a single line was added to the new version.
\bookmarksetup{startatroot}
\hypertarget{collaboration-using-git}{%
\chapter{Collaboration Using Git}\label{collaboration-using-git}}
Git has some amazing reproducible research capabilities that can become
really powerful in large complicated analyses. That said, utilizing Git
comes with an overhead that may not be justified for small projects
unless you consider collaboration with future analysts including
yourself. To demonstrate Git's collaborative potential I created a
remote repository on GitHub called git\_practice.
\hypertarget{interacting-with-your-remote-repository}{%
\subsection{Interacting with your Remote
Repository}\label{interacting-with-your-remote-repository}}
\hypertarget{git-push}{%
\subsubsection{git push}\label{git-push}}
To link your local repository to a remote repository use
\texttt{git\ remote}. In the terminal session below I added a remote
repository named ``origin'' and provided a url where the repository is
located. The second command created a new branch in the remote named
\texttt{main}. The third command ``pushed'' my local repository to my
remote repository. Files associated with this repository are now stored
in a location where they can be accessed by others for viewing,
download, or collaborative work.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git remote add origin https://github.com/adamreimer/git\_practice.git}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (\{main\})}
\NormalTok{$ git branch {-}M main}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$ git push {-}u origin main}
\NormalTok{Enumerating objects: 11, done.}
\NormalTok{Counting objects: 100\% (11/11), done.}
\NormalTok{Delta compression using up to 16 threads}
\NormalTok{Compressing objects: 100\% (10/10), done.}
\NormalTok{Writing objects: 100\% (11/11), 1.53 KiB | 8.00 KiB/s, done.}
\NormalTok{Total 11 (delta 2), reused 0 (delta 0), pack{-}reused 0}
\NormalTok{remote: Resolving deltas: 100\% (2/2), done.}
\NormalTok{To https://github.com/adamreimer/git\_practice.git}
\NormalTok{ * [new branch] main {-}\textgreater{} main}
\NormalTok{branch \textquotesingle{}main\textquotesingle{} set up to track \textquotesingle{}origin/main\textquotesingle{}.}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$}
\end{Highlighting}
\end{Shaded}
After pushing to github your repository now looks like
Figure~\ref{fig-push}.
\begin{figure}
{\centering \includegraphics{collaboration_files/figure-pdf/fig-push-1.pdf}
}
\caption{\label{fig-push}The Git workspace after your local repository
has been pushed to a remote repository.}
\end{figure}
Now that we have a remote repository updated we have to worry about
keeping them both synced. To illustrate this workflow I'll change the
\texttt{fib\_seq.r} file by adding the fifth value to the Fibonacci
sequence
(\texttt{fib\_seq{[}5{]}\ \textless{}-\ fib\_seq{[}3{]}\ +\ fib\_seq{[}4{]}})
as a new line. After this change the git work space will contain an
unstaged change which is not reflected in either repository.
\begin{figure}
{\centering \includegraphics{collaboration_files/figure-pdf/fig-changewremote-1.pdf}
}
\caption{\label{fig-changewremote}The Git workspace after the working
directory has been changed leaving the local and remote repositories
out-of-date.}
\end{figure}
In the terminal session below I stage the file \texttt{fib\_seq.R} and
commit the file. Notice the first time we submitted a
\texttt{git\ status} command we were told the local and remote
repositories were synced but that there were unstaged changes. After the
modified file was added and committed the second call to
\texttt{git\ status} tells us our remote repository is one commit behind
our local repository. The git work space at this moment is illustrated
by Figure~\ref{fig-commitwremote}.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$ git status}
\NormalTok{On branch main}
\NormalTok{Your branch is up to date with \textquotesingle{}origin/main\textquotesingle{}.}
\NormalTok{Changes not staged for commit:}
\NormalTok{ (use "git add \textless{}file\textgreater{}..." to update what will be committed)}
\NormalTok{ (use "git restore \textless{}file\textgreater{}..." to discard changes in working directory)}
\NormalTok{ modified: fib\_seq.R}
\NormalTok{no changes added to commit (use "git add" and/or "git commit {-}a")}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$ git add fib\_seq.R}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$ git commit {-}m "Fifth entry in the Fibonacci sequence" {-}m "A long and descriptive description"}
\NormalTok{[main 5139049] Fifth entry in the Fibonacci sequence}
\NormalTok{ 1 file changed, 2 insertions(+), 1 deletion({-})}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$ git status}
\NormalTok{On branch main}
\NormalTok{Your branch is ahead of \textquotesingle{}origin/main\textquotesingle{} by 1 commit.}
\NormalTok{ (use "git push" to publish your local commits)}
\NormalTok{nothing to commit, working tree clean}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$}
\end{Highlighting}
\end{Shaded}
\begin{figure}
{\centering \includegraphics{collaboration_files/figure-pdf/fig-commitwremote-1.pdf}
}
\caption{\label{fig-commitwremote}The Git workspace after a local change
has been staged \& committed leaving the remote repositories one commit
behind.}
\end{figure}
In the terminal session below I use \texttt{git\ push} to update the
remote repository. Notice \texttt{git\ status} verifies the repositories
are now synced. The git work space at this moment is illustrated by
Figure~\ref{fig-pushwremote}.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$ git push}
\NormalTok{Enumerating objects: 5, done.}
\NormalTok{Counting objects: 100\% (5/5), done.}
\NormalTok{Delta compression using up to 16 threads}
\NormalTok{Compressing objects: 100\% (3/3), done.}
\NormalTok{Writing objects: 100\% (3/3), 414 bytes | 8.00 KiB/s, done.}
\NormalTok{Total 3 (delta 1), reused 0 (delta 0), pack{-}reused 0}
\NormalTok{remote: Resolving deltas: 100\% (1/1), completed with 1 local object.}
\NormalTok{To https://github.com/adamreimer/git\_practice.git}
\NormalTok{ 0c92881..5139049 main {-}\textgreater{} main}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$ git status}
\NormalTok{On branch main}
\NormalTok{Your branch is up to date with \textquotesingle{}origin/main\textquotesingle{}.}
\NormalTok{nothing to commit, working tree clean}
\NormalTok{amreimer@DFGSXQDSF223076 MINGW64 /s/RTS/Reimer/Research\_Best\_Practices/git\_practice (main)}
\NormalTok{$}
\end{Highlighting}
\end{Shaded}
\begin{figure}
{\centering \includegraphics{collaboration_files/figure-pdf/fig-pushwremote-1.pdf}
}
\caption{\label{fig-pushwremote}The Git workspace after a local change
has been staged, committed, and pushed.}
\end{figure}
\hypertarget{git-clone}{%
\subsubsection{git clone}\label{git-clone}}
Imagine a situation where you would like to work on your analysis from a
home computer\footnote{I hope your analysis is on the network and you
could use vpn to solve this problem.}. If your analysis is stored as a