Modern Plain Text Social Science: Week 06
October 7, 2024
These services are good for a lot of things, and some of them are like backups in some ways, but they are also not really backups.
E.g., Backblaze.
If ensuring that you have access to your work in the event your laptop is stolen, dropped, lost, breaks, fails, or has coffee spilled on it is not worth nine bucks a month to you, perhaps reconsider the value of your time, your personal risk tolerance, and your career choices.
“To remember everything is a form of madness.”
You are going to see a lot of diagrams like this in papers, talks, and seminars you’re required to take.
git
, it exists as a “hidden” folder that has a record of all the changes. It’s stored inside the project. To create it, we initialise the repo..git
folder is “hidden” because its name begins with a dot.git add <filename>
.git
folder.-m
is for our benefit. It should be terse and informative about what’s new, fixed, or changed in the commit..git
folder, a compressed version of the file is created..git
folder that sits at the root of our project. Conceptually we think of it as its own separate thing that git is managing for us..git
folder that sits at the root of our project. Conceptually we think of it as its own separate thing that git is managing for us..git
folder inside the project. Again, think of it as a separate entity, the local repository.git add <filename>
and git commit -m "Message"
git add -u
to stage any changes to every already-tracked file.git add -u
There’s no such thing as the Cloud
It’s just someone else’s computer
push
changes to GitHub or wherever our remote repository is located.git pull
What if you want to work with someone else’s project?
gh
command line tool, which is for using git
specifically with GitHubgit clone
puts the repo in your current folder.
❯ cd Documents/data/
❯ git clone https://github.com/kjhealy/covid-project.git
Cloning into 'covid-project'...
remote: Enumerating objects: 23, done.
remote: Counting objects: 100% (23/23), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 23 (delta 8), reused 22 (delta 7), pack-reused 0 (from 0)
Receiving objects: 100% (23/23), 577.21 KiB | 5.77 MiB/s, done.
Resolving deltas: 100% (8/8), done.
❯ cd covid-project/
❯ ls
README.md covid.Rproj covidcases.qmd data
Now you have access to the full history and any branches, etc.
Use git diff
to compare your working folder with the most recent commit (the default), or to compare changes between two commits.
Here’s the state of this course’s project as I write this:
idlewild ~/D/c/mptc git:main ❯ git status
On branch main
Your branch is ahead of 'origin/main' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: slides/05-slides.qmd
modified: slides/06-slides.qmd
Untracked files:
(use "git add <file>..." to include in what will be committed)
assets/04-git/04-github-clone.png
assets/04-git/04-github-covidproject.png
data/dfstrat.csv
no changes added to commit (use "git add" and/or "git commit -a")
❯ git log
commit 6df6d6b10b127e87115dceac06c869150b67e800 (HEAD -> main, origin/main)
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 17:49:33 2023 -0400
Began writeup
commit ef0772106fe4d6f10ee62afd3c951ff14b16efb1
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 17:38:55 2023 -0400
Data and Rproj files
commit f43f6f10ba5cd1a57430c032c8c14f056b154e9b
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 17:34:08 2023 -0400
Added covidcases
SHA
hash.> git log --oneline
6df6d6b (HEAD -> main, origin/main) Began writeup
ef07721 Data and Rproj files
f43f6f1 Added covidcases
HEAD
main
branchcovidcases.qmd
# Back at the shell here
> git status
On branch figtest
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: covidcases.qmd
no changes added to commit (use "git add" and/or "git commit -a")
> git log --abbrev-commit
commit 912aed7 (HEAD -> figtest)
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 20:25:42 2023 -0400
Checking ggplot code
commit 6df6d6b (origin/main, main)
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 17:49:33 2023 -0400
Began writeup
commit ef07721
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 17:38:55 2023 -0400
Data and Rproj files
commit f43f6f1
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 17:34:08 2023 -0400
Added covidcases
main
> git merge figtest
Updating 6df6d6b..4a77b2f
Fast-forward
covidcases.qmd | 13 +++++++++++++
1 file changed, 13 insertions(+)
> git log --abbrev-comit
commit 06677f4 (HEAD -> main, origin/main)
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 20:45:10 2023 -0400
Load the US data
commit 4a77b2f (origin/figtest, figtest)
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 20:33:57 2023 -0400
Fixed the plot
commit 912aed7
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 20:25:42 2023 -0400
Checking ggplot code
commit 6df6d6b
Author: Kieran Healy <kjhealy@gmail.com>
Date: Mon Sep 18 17:49:33 2023 -0400
Began writeup
add
, commit
, and push
the results.