<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/beyond-basic-r-version-control-with-git/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://owi.usgs.gov/blog/beyond-basic-git/"> The USGS OWI blog </a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Depending on how new you are to software development and/or R programming, you may have heard people mention version control, Git, or GitHub. Version control refers to the idea of tracking changes to files through time and various contributors. Git is an example of a version control tool, and GitHub is a popular web interface for Git. That's it. Easy!</p>
<p><strong><em>But wait, I would need to learn an additional tool?</em></strong></p>
<p>Yes, but don’t panic! Git is a tool with various commands that you can use to help track your changes. Luckily, you don't need to know too many commands in Git to use the basic functionality. As an added bonus, using Git with RStudio takes away some of the burden of knowing Git commands by including buttons for common actions.</p>
<p>As with any tool that you pick up to help your scientific workflows, there is some upfront work before you can start seeing the benefits. Don't let that deter you. Git can be very easy once you get the gist. Think about the benefits of being able to track changes: you can make some changes, have a record of that change and who made it, and you can tie that change to a specific problem that was reported or feature request that was noted.</p>
<p>Tracking changes are not the only benefit of using Git and GitHub. If you work on your code with other than just yourself, Git and GitHub is a great way to facilitate collaboration and simultaneous code development. Multiple people can work on the same body of code at one time and request to combine their edits/additions/deletions into the main code along with a peer review. You can &quot;freezeâ€� your body of code at a specific version so that you can reference it at that state in the future (perfect for referencing your scripts in a paper). You can also work on separate features at one time without one depending on the other, so you can easily keep one but discard the other.</p>
<p>Need more convincing? Check these out:</p>
<ul>
<li>First three sections of <a rel="nofollow" href="http://r-bio.github.io/intro-git-rstudio/" target="_blank">An introduction to Git and how to use it with RStudio</a> – What is version control?, What is Git?, and What is GitHub? (FranÃ§ois Michonneau)</li>
<li><a rel="nofollow" href="https://peerj.com/preprints/3159.pdf" target="_blank">Excuse me, do you have a moment to talk about version control?</a> (Jenny Bryan)</li>
</ul>
<p><strong><em>Let's try it! Where do I start?</em></strong></p>
<p>Ease into using Git and GitHub. There is no need need to jump into the deep end with a full blown Git project to start learning about Git. We suggest you start by creating an account and following a repository for a package or project available on USGS-R. You'll start to get notifications for the repository and can check in periodically to see how others are using Git and GitHub to track their code changes, manage project features and bugs, and collaborate effectively as a team. It will also make you feel more comfortable with the terminology.</p>
<p>If you'd rather start by getting a project setup in Git and GitHub, you can follow our <a rel="nofollow" href="https://owi.usgs.gov/R/training-curriculum/r-package-dev/git/" target="_blank">lesson on version control in the R Package Development</a> curriculum. Please note that you don't need to be creating an R package to use Git or GitHub. Here is <a rel="nofollow" href="https://github.com/USGS-R/exampleRproj" target="_blank">an example of a basic R project</a> that has R code, is not a package, and uses Git and GitHub.</p>
<p>There are many existing blogs and websites that dive into how to use these tools. There are also many different ways to use apply Git and GitHub to create an effective workflow. We suggest you follow the typical workflow used by the community at USGS-R; see our <a rel="nofollow" href="https://owi.usgs.gov/R/training-curriculum/r-package-dev/git/#our-recommended-workflow" target="_blank">lesson on version control from the R Package Development</a> course. Here are some other resources for mastering Git and GitHub:</p>
<ul>
<li><a rel="nofollow" href="http://happygitwithr.com/" target="_blank">Happy Git and GitHub for the useR</a> (Jenny Bryan)</li>
<li><a rel="nofollow" href="https://maraaverick.rbind.io/2017/12/git-guides/" target="_blank">Git guides</a> (Mara Averick)</li>
<li><a rel="nofollow" href="http://r-pkgs.had.co.nz/git.html" target="_blank">Git and GitHub</a> from R Packages (Hadley Wickham)</li>
<li><a rel="nofollow" href="https://rmhogervorst.nl/cleancode/blog/2016/03/01/content/post/2016-03-01-version-control-start/" target="_blank">Version control with Git</a> (Roel M. Hogervorst)</li>
</ul>
<hr>
<p><em>Any use of trade, firm, or product names is for descriptive purposes only and does not imply endorsement by the U.S. Government.</em></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://owi.usgs.gov/blog/beyond-basic-git/"> The USGS OWI blog </a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/EJsPldeWmxY" height="1"></a></div>