https://github.com/MarieEtienne/reproductibilite
2025-09-10
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 "Change title"
, and once again check the project status.
Draw the commit tree.
In the working directory, let’s try different poses (the version of the project in the working directory)
When satisfied by the pose of one guy, ask him stop moving (Staging area)
When satisfied with the whole scene, take the photo (Commit in the local repo)
The current version of the project is indeed recorded in the version control system, but you are the only ones who know it.
You may want to share these changes to the remote repository from which we started.
To view the differences with the remote repository, use git diff origin/master
.
To send our changes, , use git push
.
To github.com:MarieEtienne/stats-reminders.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'github.com:MarieEtienne/stats-reminders.git'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
, why ?
Be sure that all your changes have been committed
when works are diverged, you can have different attitudes. We go for the simple one for now and we need to specify this config for git
Retrieve the last version of the project on the server: git pull origin master
This might highlights conflicts: In case of conflict, you receive a very nasty message.
Portion between <<<<<<< HEAD
and =======
is your local version, while part between =======
and >>>>>>> dfdf5995ade6e47899531a99e5947e719da86020
is the version available at commit with hash dfdf5995ade6e47899531a99e5947e719da86020.
Problem: the merge commit is not very readable in the development process. But one step at a time
Change someting in your local version of Penguins_chapter.qmd
,
git add, commit, pull
…..
Solve conflicts
`git push’
Problem: Too much time spent at solving conflicts. We need another to minimize conflilcts
T1
T2
T3
Associate trees with actions
Working in parralel and merging from time to time
Working in parallel:
Merging test within master:
Creat a local branch and navigating between different branches
Go on Github and look !
Create a second test branch test_branch2
and make some changes
We want to incorprate change make in test_branch2 in your personnal branch
Creates your own test_branch from the master branch and go on this branch
Remove Penguins_chapter.qmd
from the versioning system git rm Penguins_chapter.qmd
list the content your directory
Commit your changes in your branch
Switch to the master branch
List the contents of your directory
Delete your test_branch git branch -d NAME_OF_YOUR_BRANCH
Create a branch and switch to this branch
Create a qmd file, name `Row_id.qmd”, id being the order of your row, 1 is the closes to the board.
Work by team, (a team = a row), to crate and solve conflicts
git fetch: update local info about remote
git rebase origin/master: reapply work on top of your branch
git merge: integrate cleanly
you can delete your branch once your work is included
To go back to a previous specific version, use the checkout
command
You can branch from this moment if you want to and start developping this new branch
The current working version of Penguins_chapter.qmd
is in the state of commit A_specific_hash_version_number
The purpose of reset function
To remove all history, going back in commit number G (remove definitely commit H and I)
Be very very very careful, it is a destructive process. All information regarding your previous commit is lost.
Before reset
After reset
It’s a very dangerous way of living with Git, an unfortunate removal of a commit present on the remote server can break the commit trees for all your coworkers and you won’t have friends anymore.
Remove the file Penguins_chapter.qmd
, and commit this change
List the contents of your directory
Go back one commit in time using reset
List the contents of your directory
You can’t destroy common history, you have to update it
You can “suppress” this commit by applying the opposit! Let’s we want to remove change in the project made in commit \(B\)
Only th change made to come from A to B are reversed. Of course it might produce conflicts you have to solve.
This becomes more difficult with dirty merge commits, so try to keep a clean history
Before reset
After revert
Git is a standard control version system in industry AND research for version control (whether you use it with Github or not),
Being proficient with Git requires to use it as much as possible: The more problems you have, the more you learn
Go back to the documentation as much as needed
By no means, Git is an alternative to a proper documented code (in R you might want to use package like formatR
, styleR
and document it with roxygen
)
A short quizz on November 5th, to check your understanding of git behaviours command, errors and message. It could be explaining in words the development of a project by looking at a project history, explaining the actions to be taken according to one mean git message, explaining the purpose of one command. No need to learn commands, regulard practice before this date should be enough.
Stats reminder project
For next session: 3 teams
Within each team, 3 specific mthods within the gen,eral team, illusrated by an ecological example.