class: title-slide, center, middle background-image: url(https://images.unsplash.com/photo-1582769923195-c6e60dc1d8dc?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=764&q=80) background-size: cover # <span style=" font-weight: bold; color: white !important;border-radius: 4px; padding-right: 4px; padding-left: 4px; background-color: #0091ad !important;font-size: 80px;" >Git & Github</span> # <span style=" font-weight: bold; color: white !important;border-radius: 4px; padding-right: 4px; padding-left: 4px; background-color: #0091ad !important;font-size: 60px;" >A short intro</span> <br> <h2><span style=" font-weight: bold; color: white !important;border-radius: 4px; padding-right: 4px; padding-left: 4px; background-color: #2e6f95 !important;" >Miriam Lerma</span></h2> <h3><span style=" font-weight: bold; color: white !important;border-radius: 4px; padding-right: 4px; padding-left: 4px; background-color: #455e89 !important;" >October 2021</span></h3> --- class: inverse # Intro - [Git](#git) - [Github](#github) - [Reproducibility](#repro) - [Git+Github](#git_github) - [Organice projects](#organize) --- name: git class: center, middle, inverse # 1. Git --- ## 1.2. Git <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e0/Git-logo.svg/200px-Git-logo.svg.png" height="50" style="display: block; margin: auto;" /> **Git** is a version control software (VCS-Version control system). - The advantages of using **version control** is that you can modify your code/analyses and have a safe backup. In you **repository** you can have always the latest version - It also allows you to have the history of changes that you have done to your **repository** and be able to trace back to old files. You can go back to older version on your projects - You repository can be only local if you dont want to put it online **Cons**: - It takes some time to get use to it - It was developed by programmers so its usually not very intuitive to use --- ## 1.3. Install - To dowload :<br> Webpage: [git](https://git-scm.com/) - Select your OS (operating system):<br> [Windows](https://happygitwithr.com/install-git.html#install-git-windows)<br> [macOS](https://happygitwithr.com/install-git.html#macos)<br> [Linux](https://happygitwithr.com/install-git.html#linux) - The installation is very different between computers - You only need to install it once --- name: github class: center, middle, inverse # 2. Github --- ## 2.1. What is GitHub <img src="https://avatars.githubusercontent.com/u/583231?v=4" height="200" style="display: block; margin: auto;" /> [Github](https://github.com/): is a provider of internet hosting for software development and version control using git <br> However, it is not the only one and there are many other platforms to host repositories. <br> For example: [gitlab](https://about.gitlab.com/) <img src="https://about.gitlab.com/images/press/press-kit-icon.svg" height="80" style="display: block; margin: auto;" /> Which one to use? Discussion between [Github o Gitlab](https://rachelcarmena.github.io/2018/12/12/how-to-teach-git.html) --- ## 2.1. Why Github - It allows you to have a backup of your project online - Allows collaboration - Simplifies remote work <img src="002Colaboration.png" width="1671" height="400" style="display: block; margin: auto;" /> --- ## 2.2. To use GitHub You need to register [Github](https://github.com/) <br> <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Github1.png" height="400" /> --- ## 2.3. Create an user name You can register using your email <br> <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Github2.png" height="250" style="display: block; margin: auto;" /> **Recommended** - Use a similar name that the one from your publications, so people can easily find you and trust your repository - Select a name that you feel comfortable to use in the future - Short names are preferred than long names - Separate name using _ or - [Click here for further reading](https://happygitwithr.com/github-acct.html) --- ## 2.4. Create a repository There are many ways to create a repository, using the **+** symbol next to your picture is one. <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Github3.png" height="400" style="display: block; margin: auto;" /> --- ## 2.5. Make a public repository In the description of your repository, you can select if you want to make it public or private. You can change it later if you want to. <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Github4.png" height="400" style="display: block; margin: auto;" /> --- ## 2.6. Upload files in your repository - There are also many ways to upload files. Initially you can just **upload an existing file** <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Github6.png" height="100" style="display: block; margin: auto;" /> --- ## 2.7. Repository Select your files, **commit changes** and there is your repository. <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Github7.png" height="400" style="display: block; margin: auto;" /> To share it, you can go to setting and add the email of the person you want to share it with. --- name: repro class: center, middle, inverse # 3. Reproducibility --- # 3.1. Share - Work locally, share globally. You can collaborate with many people working on the same projects. <img src="https://miro.medium.com/max/700/0*68fyM5AI85U_I3vo.jpg" height="400" style="display: block; margin: auto;" /> --- ## 3.1. Share But not only that! you can help your future **you** to be replicate your analyses. <img src="https://pbs.twimg.com/media/EjQ5HsYXkAAqXmj.jpg" height="400" style="display: block; margin: auto;" /> ... or your students, employees, etc... --- ## 3.3. Reproducibility crisis .pull-left[ From 1500 researchers that try to reproduce published research, 70% failed. This has been quoted a reproducibility crisis. - [
Ted talk](https://www.youtube.com/watch?v=FpCrY7x5nEE) ] .pull-right[ <img src="https://www.nature.com/news/polopoly_fs/7.36716.1469695923!/image/reproducibility-graphic-online1.jpeg_gen/derivatives/landscape_630/reproducibility-graphic-online1.jpeg" height="300" style="display: block; margin: auto;" /> ] .right[Source: [nature](https://www.nature.com/news/1-500-scientists-lift-the-lid-on-reproducibility-1.19970)] --- ## 3.4. Reproducibility crisis There is low reproducibility in ecology ([Culina 2020](https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.3000763)) - **73%** from published papers (between 2015 and 2019, n = 346) do not include code - **5%** not all the code - **1%** no data - **21%** almost reproducible (26% do not use free software, 56% do not include data set, y 46% not version of the software) <img src="https://media.eurekalert.org/multimedia_prod/pub/web/238857_web.jpg" height="300" style="display: block; margin: auto;" /> .right[ Source: [@Culina](https://twitter.com/antica_c/status/1288382890636709888)] --- ## 3.5. Old code .pull-left[ Interestingly, the low reproducibility does not apply to only to work form other scientist but also their **own** research. Lack of documentation and old programs were the main problems to reproduce research from 10 years ago ] .pull-right[ - [Ten years reproducibility challenge](https://rescience.github.io/ten-years/) <img src="https://media.nature.com/w1172/magazine-assets/d41586-020-02462-7/d41586-020-02462-7_18291680.jpg" height="250" /> Source: [nature](https://www.nature.com/articles/d41586-020-02462-7) ] --- ## 3.6. Gradient of reproducibility .center[<h4>Text + Data + Code</h4>] <img src="https://raw.githubusercontent.com/Pakillo/writing-reproducible-manuscripts/master/images/Fig1.jpg" height="300" style="display: block; margin: auto;" /> .right[Source: [Pakillo](https://github.com/Pakillo/writing-reproducible-manuscripts) ] --- name: git_github class: center, middle, inverse # 4. Git + Github --- ## 4.1. Git + Github You can share projects, code, workflows. Ho I do it is by: - Creating an R project - Having git installed - Having git connected : [introduce yourself to git](https://happygitwithr.com/hello-git.html) - Having a github account To read more: - [Cheat Sheets](https://levelup.gitconnected.com/understanding-git-a-beginners-guide-containing-cheat-sheets-resources-b50c9c01a107) - [What is version control](https://www.atlassian.com/git/tutorials/what-is-version-control) - [How to teach git](https://rachelcarmena.github.io/2018/12/12/how-to-teach-git.html) --- ## 4.2. R projects Instead of uploading file by file, you can connect your git to an R project in RStudio. **RStudio** is an Integrated Development Environment (IDE) for R, a programming language for statistical computing and graphics. Note that you can have R scripts and SQL queries in RStudio. <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Git01.png" height="350" style="display: block; margin: auto;" /> --- ## 4.3. Version control Very briefly: - On R Studio you can select the project option of having a version control. <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Git02.png" height="400" style="display: block; margin: auto;" /> --- ## 4.4. Clone - You copy the link that you created online in your repository <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Git03.png" height="400" style="display: block; margin: auto;" /> --- ## 4.5. Repositorio - You paste the link on your git repository. <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Git04.png" height="400" style="display: block; margin: auto;" /> --- ## 4.6. PestaƱa - If it works you will have the following icons. <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Git05.png" height="300" style="display: block; margin: auto;" /> --- ## 4.7. Pull Now you can either download everything that was in the repository <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Git07-pestania.png" height="200" style="display: block; margin: auto;" /> This screen will appear <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Git06-pull.png" height="200" style="display: block; margin: auto;" /> --- ## 4.8. Stage & Commit You can then change the files, and add a commit. <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Git08-commit.png" height="200" style="display: block; margin: auto;" /> **Important** Every time we make a commit git storage it with a 40-digit unique code. It is important to add the commit message to be able to identify the change in the future. It is very unlikely that we will remember the 40-digit code! If you have an older project you can click on the history and see what I mean. --- ## 4.9. Push Now to upload it to github and make the latest version available to collaborators you need to click on **push**. This screen will appear <img src="https://raw.githubusercontent.com/MiriamLL/Curso_CIAD/main/Figuras/Git09-push.png" height="300" style="display: block; margin: auto;" /> --- name: organize class: center, middle, inverse # 5. Organize --- ## 5.1. Naming things I share my repository... What are all those files in the repository? -- **Difficult names**: - Final December Introduction.pdf - Model.xlsx - Figure12.png -- - Final December Introduction-2.pdf - Models.txt - Figure1234.docx -- - Final December Introduction-2_Final.pdf -- - Final December Introduction-2_Final-Rev.pdf Source: [Stephanie Orellana](https://sporella.github.io/nombrar_cosas/#3), [Jenny Bryan](http://www2.stat.duke.edu/~rcs46/lectures_2015/01-markdown-git/slides/naming-slides/naming-slides.pdf) --- ## 5.2. Good names
Machine readable - Use key words - No special characters - No punctuation, use "_" to separate names with more than one word - **Avoid** : Using similar key words for files with different contents --
Human readable You can easily understand what the files contents are. - 01_Introduction.docx - 02_Analisis_ANOVA.Rmd --
Plays well with default ordering Using something numeric at the beginning allows you to order by default, and the best its include zeros. If we do not include zeros at the beginning, it would not line with the 10. - 01_Introduction.docx - 02_Discussion.docx - 03_Tables.docx --- name: end class: center, middle, inverse # Keen to learn more? .left[- Happy git: [
Happy Git by Jennifer Bryan](https://happygitwithr.com/)<br> - Tutorials [
RLadiesFreiburg](https://www.youtube.com/watch?v=tSse0KPgSoQ&t=1s) - Image by [Unsplash by Adam Gonzales](https://unsplash.com/@adamgonzales)] <br> <br> .right[This material is all accessible in <br> my [
github](https://github.com/MiriamLL/Curso_CIAD/) and my [
blog](https://www.miriam-lerma.com/materiales.html) <br> <br> [
Home ](https://www.miriam-lerma.com) [
Start ](https://miriamll.github.io/git_pres/GitGithubZenodo#1) ]