%%{init: { 'theme': 'neutral' } }%%
gitGraph
commit id: "Initial commit"
commit id: "Add README"
commit id: "Fix typo"
commit id: "Add Penguins_chapter.qmd"
https://github.com/MarieEtienne/reproductibilite
2025-09-10
This means copy locally on your computer the content of a repository which means
We will be using Git in CLI. The relevant command in CLI are given in the survival kit. The most useful git command will be discovered during the course
Go to your git Directory and write
Navigate to the repository you want to clone On the main page, click on the “Code” green button, be sure to select SSH and copy paste the address.
gitkwhich gitkgitkEach commit points to its parent — this is what git log is walking through, one line at a time:
%%{init: { 'theme': 'neutral' } }%%
gitGraph
commit id: "Initial commit"
commit id: "Add README"
commit id: "Fix typo"
commit id: "Add Penguins_chapter.qmd"
git log --oneline shows this same sequence, most recent on topForking creates your own copy of someone else’s repository in your GitHub account. This lets you experiment with changes without affecting the original project. How to fork a repo:
Navigate to the repository you want to fork on GitHub Click the “Fork” button in the top-right corner of the repository page Choose where to fork it - usually to your personal account Wait a moment - GitHub will create the copy in your account
You’ll have a complete copy of the repo in your GitHub account You can clone this forked version to your local machine using git clone Make changes, commit them, and push back to your fork If you want to contribute back to the original project, you can create a pull request
Your fork is independent of the original repo. You have full control over your forked version The original repo remains unchanged unless you submit a pull request that gets accepted You can sync your fork with the original repo later if it gets updated
This workflow is essential for contributing to open-source projects or collaborating on code when you don’t have direct write access to the original repository.
Remove the OCR_TP and its content
Fork https://github.com/MarieEtienne/OCR_TP on your personnal GitHub account
clone your version of OCR_TP
Show the history of this file
Penguins_chapter.qmd and add your name and the list of authors, then save your file.Type the command git add Penguins_chapter.qmd, then repeat the previous commands.
Type the command git commit -m "Added an author", and once again check the project status.
Check the project on Github
Type the command git push", and once again check the project on Github
Make a small change in Penguins_chapter.qmd
Render the website locally with quarto renderand examine the contents of your directory.
Use git statusto identify the status of each file
Which files should be commited
The role of the .gitignore file
Add _site/ to the list of ignore files, then add .gitignore and commit.
. . . Generated files should not be versionned
main (or master) is the default branch — the one you’ve been committing to so farmain until you’re ready%%{init: { 'theme': 'neutral' } }%%
gitGraph
commit id: "Initial commit"
commit id: "Add Penguins_chapter.qmd"
branch feature
checkout feature
commit id: "Try something new"
checkout main
commit id: "Fix typo"
main keeps moving forward on its ownfeature diverges from the commit it was created ongit switch changes which branch you’re working on — your files in the working directory are updated to match that branchNote
You may see git checkout new_branch used for the same purpose in older tutorials — git switch is the newer, clearer command introduced specifically to replace this use of checkout.
Every commit in git log --oneline has a short hash/name (e.g. a1b2c3d) — you can jump straight to it, not just to a branch:
%%{init: { 'theme': 'neutral' } }%%
gitGraph
commit id: "Initial commit"
commit id: "Add README"
commit id: "Fix typo"
commit id: "Add Penguins_chapter.qmd"
git switch --detach to the “Fix typo” commit lets you look around as if you were back at that momentmainImportant
If you just want to see what a file looked like at a given commit, without leaving your current branch:
git branch — check which branch you’re currently ongit switch -c try_something — create and move to a new branchPenguins_chapter.qmd (any small change), then git add and git commit your changegit log --oneline — see your new commitgit switch main — go back to maingit log --oneline — notice your last commit is not here: it only exists on try_somethinggit switch try_something — go back and check it’s still theregit log --oneline — pick the hash of an earlier commitgit switch --detach <hash> — visit it, open Penguins_chapter.qmd, check its contentgit switch try_something — come back to the present