git
Session 4
September 12, 2024
What are your questions from last session?
What stood out to you when you diagrammed your file system?
If your current working directory is Users/kristinariemer/Dropbox/Documents
, what command could be used to change directory into the local Documents folder?
Version Control
Semi-automated system for tracking changes with unlimited “undo”
Track development of research projects like a lab notebook
Keep project in sync across computers including HPC
Share and collaborate on projects in a clear and manageable way
Git: version control on your computer.
GitHub: connects your local Git to the cloud.
Project management
Collaboration
Visual interface
Optional, but we will be using it!
We installed git last week, so you should be ready to set it up!
git
verb
options
git config --global core.editor "vim"
--help
flag to see optionsYou have options:
git init
in an existing directory/R Projectusethis::use_git
in an existing R Projectgit init
git init
git init
git init
from the command linegit init
usethis::use_git()
usethis::use_git()
usethis::use_git()
git status
git status
againgit add
git commit --m "foo"
git diff
git restore
to reset saved changes to the last commitgit reset HEAD\~
to (effectively) undo an add-commit cycle.gitignore
git
handles keeping track of versions and changesgit
workflow is the modify-add-commit cyclegit
can travel backwards in time.gitignore