SORTEE Code Club is an online meeting where people come together to learn, share, and collaborate on coding-related topics in an informal and supportive environment
Do you know about SORTEE Resources?
Goal for the next 60 minutes:
Understand how version control can make your research more robust, reproducible, and less stressful.
How do you track changes over time?
Which one is the actual final version?
It’s like “Track Changes” for your entire project folder.
Git is the TOOL
GitHub is the PLACE
You use Git locally, and you can optionally push your work to GitHub.
Popular Alternatives:
git add
) to tell Git, “include this changes”git commit
) from the staging area into your project’s historygit pull
: Fetches changes from the Remote Repo to your Local Repo (essential for collaboration)git push
: Sends your committed changes from your Local Repo to the Remote RepoCommands and the preferred order:
git init
: Turn a folder into a Git repository.git status
: Check the state of our three areas.git add <filename>
: Move a file to the Staging Area.git commit -m "Your message"
: Save the snapshot to the Repository.git log
: View the project’s history.git branch statistical-model
git add
and git commit
git checkout main
and git diff
A commit message is a note to your future self and collaborators.
Why it matters: git log
becomes a readable story of your project’s evolution.
git commit -m "stuff"
git commit -m "Fix bug in statistical calculation"
What if you staged the wrong file or made a typo in your last commit? Git is forgiving!
git add bad_file.R
but didn’t mean to.git reset HEAD bad_file.R
to move it back to your Working Directory. git status
will guide you!git commit --amend -m "A corrected message"
git add forgotten_file.R
then git commit --amend
.This is a safe way to fix local mistakes before you push them to GitHub.
git checkout
: You can visit the past but you can’t change itgit revert
: You can’t change the past, but you can write a new entry that corrects the recordgit reset
: You go back and destroy the previous timeline. Marti McFly will never be born.Everything is simpler, then!
No need to hard code, you can use the IDE!
git status
git add
git diff --staged
git commit -m "Message"
.gitignore
: What to Leave OutYou don’t want to track everything!
.gitignore
tells Git which files or folders to ignore.You should ignore:
.DS_Store
, Thumbs.db
, .RData
, .Renviron
).Services like Zenodo can link to your GitHub repository.
git push
to GitHub.This makes your software and analysis a citable research output!
No Code Club next month!
SORTEE Virtual Conference will run from October 15th to October 16th! You can register here, it’s free for SORTEE Members!