Oops, Git!
How to recover from common mistakes
Maëlle Salmon https://oops-git.netlify.app/
Git is a Version Control System (VCS).
This makes Git more like a mini filesystem with some incredibly powerful tools built on top of it, rather than simply a VCS [version control system].
after you commit a snapshot into Git, it is very difficult to lose, especially if you regularly push your database to another repository.
📜 History to use
🌳 Branches
Sometimes it hurts. 😱
Can you share ugly things that happened to you with Git?
Sometimes it hurts. 😱
💪 Prevent some problems
💪 Practice how to successfully get out of some horrible situations.
In your usual Git environment.
Can you write how you use Git? Me: Positron+terminal sometimes.
Show where Git is, the R console, the terminal.
Show where Git is, the R console, the terminal.
Do you dare to share?
usethis::git_sitrep()👀 Staging area
👀 Branch
👀 Remote (GitHub?) vs local (your computer)
In temporary folders created by saperlipopette.
So we don’t break our important projects.
A tool for using Git
An R package for creating exercises in your own folders.
R to create the exercise in another folder.
R in the new session to read the instructions.
Your usual tools to solve the Git problem!
Call a function from an R session.
Go to the created folder (seen in the output).
Open R in this folder, read the instructions.
Work with your Git tools or the terminal.
Close the exercise session.
I will make demos and then you will do them too.
See also saperlipopette::exo_check_editor().
15 minutes to solve these exercises. 😈
15 minutes to solve these exercises. 😈
15 minutes to solve these exercises. 😈
rebase -i or some other barbarismSolve it yourself in 10 minutes.
✨ .gitignore ✨
I create secret-folder/.
I see it in the staging area.
I add secret-folder to my .gitignore.
I don’t see it in the staging area anymore.
usethis::git_vaccinate()
🚀 git push -f
But
🔥 not in shared branches
🔥 does not completely remove the old commit on GitHub https://github.com/ropensci-training/saperlipopette/pull/26
How to suffer less with Git?
Preventing problems: know where you are, use .gitignore (, don’t use Vim).
Learning how to get out of horrible situations.
Thank you! 💙 Thanks to Dariia Mykhailyshyna and Yanina Bellini Saibene.
Book Git in Practice by Mike McQuaid (reading notes)
Book Pro Git by Scott Chacon (reading notes)
“What they forgot to teach you about R”. now (E. David Aja) and then (Jenny Bryan, Shannon Pileggi).
Happy Git and GitHub for the useR by Jenny Bryan, the STAT 545 TAs, Jim Hester.
Julia Evans’ zines “Oh shit, Git!” and “How Git works”