class: center, middle, inverse, title-slide # Git Around the World
###
Cosima Meyer | 2021-04-20 --- # What is Git? - A software that allows you to track changes β [**version control**](https://git-scm.com/book/en/v2/Getting-Started-What-is-Git%3F) - It allows you to **work collaboratively in teams** - But it's also great to have your **own personal version control!** -- <br><br><br> .center[[](https://media.giphy.com/media/PjTSEQy85NKOlZ7b19/giphy.gif)] <br> .tiny[[Giphy](https://media.giphy.com/media/PjTSEQy85NKOlZ7b19/giphy.gif)] --- ### Growing trees π³  --- ### Growing trees π³  --- ### Growing trees π³  --- ### Growing trees π³  --- ### Growing trees π³  --- ### Growing trees π³  --- ### Growing trees π³  --- ### Growing trees π³  --- ### Growing trees π³  --- ### Growing trees π³  --- # Intuition - How does Git work?  --- # Intuition - How does Git work?  --- # Intuition - How does Git work?  --- # Intuition - How does Git work?  --- # Intuition - How does Git work?  --- # Intuition - How does Git work?  --- # Intuition - How does Git work?  --- # Intuition - How does Git work?  --- # Intuition - How does Git work?  --- ## You can call the commands in the terminal... .center[] <span style="font-size:2em">.right[**... but it's also integrated in RStudio** π©πΌβπ»]</span> --- ## Basic steps when starting a new project  --- ## Basic steps when starting a new project  --- ## Basic steps when starting a new project  --- ## Basic steps when starting a new project  --- ## Basic steps when starting a new project  --- ## Basic steps when starting a new project  --- ## Basic steps when starting a new project  --- class: inverse, center <br><br> <span style="font-size:3em">Practice π»</span> <br><br><br><br><br> <span style="font-size:1.5em">π [workflow description](http://cosimameyer.rbind.io/post/how-to-structure-your-data-workflow-efficiently-using-r/)</span> --- ### Step-by-step 1) Create a new GitHub repository .center[] --- ### Step-by-step 2) Create an .Rproj .center[] --- ### Step-by-step 3) Link it with your GitHub repository .center[] --- ### Step-by-step 4) You're all set: Your version control is up-and-running! <span style="font-size:1.5em">π₯³</span>  --- ### Step-by-step 5) Populate your project ```r # Set up the folder structure folder_names <- ( # Main folders c("data", "code", "figures", # Sub-folders "data/raw", "data/processed")) for (j in seq_along(folder_names)) { dir.create(folder_names[j]) } ``` --- ### Step-by-step 5) Populate your project ```r # Add files to the folders file_names <- ( c( # For preparing your data "1_data_preparation", # The merging file might also be combined # with the first file "2_merging", # For your descriptives "3_descriptives", # For your analysis "4_analysis", # For your visualization "5_visualization" ) ) ``` --- ### Step-by-step 5) Populate your project ```r # Create files for (j in seq_along(file_names)) { file.create(paste0("code/", file_names[j], ".Rmd")) } # Create a helper function file file.create("code/helper.R") ``` --- ### Step-by-step 6) Commit and push your changes  --- # What else can you do with Git(Hub)? - <span style="font-size:1.5em">π </span> GitHub actions - [**deploy websites**](https://pages.github.com), - [**run package checks**](https://deanattali.com/blog/migrating-travis-to-github/) (and a more in-depth tutorial on [**package development**](https://www.mzes.uni-mannheim.de/socialsciencedatalab/article/r-package/#subsection5-4)), - [**automatize data collection**](https://github.com/features/actions), ... <br> -- - <span style="font-size:1.5em">π©πΌβπ»</span> [**Showcase your portfolio**](http://cosimameyer.rbind.io/post/personalize-your-readme-on-github/) <br> -- - <span style="font-size:1.5em">π</span> [**Education package**](https://education.github.com/pack) --- class: inverse background-image: url("img/computer3.png") background-size: 250px background-position: 95% 8% <br><br><br> ## More resources .pull-left[ - [Happy Git with R](https://happygitwithr.com) - [Jan KrΓΌger's "Git Cheat Sheet"](https://jan-krueger.net/git-cheat-sheet-take-two) - [Important Git commands](https://github.com/joshnh/Git-Commands) - ["Git through April" @ R-Ladies Seattle](https://www.meetup.com/rladies-seattle/events/) - [Frie Preu's tutorial](https://frie.codes/gost.html) and [her talk at MZES SSDL](https://github.com/SocialScienceDataLab/git-essentials) - [Arushi Garg's talk on "Best coding practices" (and version control) @ R-Ladies Bergen](https://www.youtube.com/watch?v=EvvverTVgY0) ] .pull-right[ - [economicurtis' intro to Git and RStudio](https://www.youtube.com/watch?v=KjLycV1IWqc) - [My workflow with data (short step-by-step tutorial)](http://cosimameyer.rbind.io/post/how-to-structure-your-data-workflow-efficiently-using-r/) - Alternatives to GitHub - [Renku](https://renkulab.io) - [GitLab](https://about.gitlab.com) - [BitBucket](https://bitbucket.org/product) - [Python and GitHub](https://www.youtube.com/watch?v=yYknmU_gBgs) <!-- (Tutorial on [Methods Bites]()) --> ] --- class: inverse, middle, center <img src="img/git.png" width=400 height=300> <svg style="height:0.8em;top:.04em;position:relative;fill:white;" viewBox="0 0 512 512"><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg> [@cosima_meyer](https://twitter.com/cosima_meyer) <svg style="height:0.8em;top:.04em;position:relative;fill:white;" viewBox="0 0 448 512"><path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"/></svg> [cosimameyer](https://www.linkedin.com/in/cosimameyer/) <svg style="height:0.8em;top:.04em;position:relative;fill:white;" viewBox="0 0 496 512"><path d="M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z"/></svg> [cosimameyer.rbind.io](http://cosimameyer.rbind.io) Slides at [bit.ly/git-wit](http://bit.ly/git-wit)