class: center, middle, inverse, title-slide # Reproducible research workflows for psychologists ##
Collaborate with Git & GitHub
###
Johannes Breuer & Frederik Aust ###
KU Leuven, 27.-28.04.2022
--- exclude: true --- layout: false name: git-system # Git <img src="data:image/png;base64,#img/git-system.png" width="550px" height="" style="display: block; margin: auto;" /> --- layout: true name: collabo # Collaboration --- **Add collaborators** .center[ `Settings > Manage access > Add people` ] <img src="data:image/png;base64,#img/github-add-collaborator.png" width="700px" height="" style="display: block; margin: auto;" /> --- **Add collaborators** .center[ `Project information > Members > Invite members` ] <img src="data:image/png;base64,#img/gitlab-add-collaborator.png" width="600px" height="" style="display: block; margin: auto;" /> --- GitHub provides a lot of collaboration features - Edit files in browser - Change highlighting and commenting - Interactive revise-and-resubmit workflow - [See example](https://github.com/crsh/papaja/pull/443) - Issue tracker (to-do list and discussion) - ... ??? - Rich change view - Comments on commits - GitHub workflow is used by JOSS Show git blame ;) --- Workflows for collaboration 1. "Publishing" changes without prior review - Push directly to `main` branch on GitHub -- 2. Suggest changes with review (*pull request*) - Create a new *branch* ("parallel universe" of repository) -- Edit on GitHub or in RStudio on your computer --- layout: false # Pull requests <img src="data:image/png;base64,#img/github-workflow.png" width="500px" height="" style="display: block; margin: auto;" /> 1. Pull current state of repository 2. Create new _branch_ ("parallel universe") 3. Make changes, stage, commit, & push 4. Discuss and revise changes 5. Merge changes --- layout: true # Editing on GitHub --- Small changes (to one file) in the browser on GitHub <img src="data:image/png;base64,#img/github-edit.png" width="700px" height="" style="display: block; margin: auto;" /> --- <img src="data:image/png;base64,#img/github-edit-pr.png" width="700px" height="" style="display: block; margin: auto;" /> --- <img src="data:image/png;base64,#img/github-open-pr.png" width="700px" height="" style="display: block; margin: auto;" /> ??? - Request reviewer --- name: review Reviewers can provide - comments on specific changes --- template: review <img src="data:image/png;base64,#img/github-inline-comment.png" width="700px" height="" style="display: block; margin: auto;" /> --- template: review - higher level comments on the entire pull request <img src="data:image/png;base64,#img/github-pr-review.png" width="650px" height="" style="display: block; margin: auto;" /> ??? Show how to make additional changes after review https://github.com/crsh/my-first-repository/pull/1 --- layout: true template: footer # Editing on your computer --- Larger changes across multiple files in RStudio 1. Pull current state of remote repository 2. Switch to new _branch_ ("parallel universe") 3. Make changes, stage, commit, & push .pull-left-45[ ~~~bash git pull *git branch revision *git checkout revision git status git add . git commit -m "My changes" ... *git push origin revision ~~~ ] .pull-right-45[ <img src="data:image/png;base64,#img/rstudio-branches.png" width="100%" height="" style="display: block; margin: auto;" /> ] --- <img src="data:image/png;base64,#img/github-pr-branch.png" width="100%" height="" style="display: block; margin: auto;" /> --- <img src="data:image/png;base64,#img/github-pr-branch2.png" width="100%" height="" style="display: block; margin: auto;" /> --- layout: true # Merge conflicts 😱 --- Competing changes to *the same line of text* <img src="data:image/png;base64,#img/github-merge-conflict.png" width="100%" height="" style="display: block; margin: auto;" /> --- Review competing changes marked by `<<<<<<<<` and `>>>>>>>>` <img src="data:image/png;base64,#img/github-merge-conflict-edit.png" width="100%" height="" style="display: block; margin: auto;" /> -- Again, this can be done on GitHub or in RStudio --- Stage and commit conflict resolution <img src="data:image/png;base64,#img/github-merge-conflict-resolve.png" width="100%" height="" style="display: block; margin: auto;" /> ~~~bash git add . git commit -m "Resolved merge conflict by doing something" ~~~ --- layout: false class: middle, center # Exercise time .center[[Exercise](http://frederikaust.com/reproducible-research-practices-workshop/exercises/6_github_collaboration_question.html)] .center[[Solutions](http://frederikaust.com/reproducible-research-practices-workshop/exercises/6_github_collaboration_solution.html)]