Project workflow overview - ubc-geomatics-textbook/docs GitHub Wiki

The suggested best practices for creating a Bookdown textbook chapter:

Getting started

This section will be useful as you start your work, and you will likely only work through this part once.

  1. Fork the GitHub repository from the UBC Geomatics Textbook organization here. You'll then have a copy of the textbook in your own GitHub user account for you to work on throughout the duration of the project. Forking a repository is done entirely on GitHub, without the need for your Unix shell.
  2. Clone your forked repository so that you can work locally in a text editor, word processor, and/or RStudio. You can clone a repository using the Git command git clone [url]. This will pull the repository to your local working directory.
  3. in RStudio, install the R package bookdown but running this in your console: install.packages("bookdown")
  4. In RStudio, open the book.Rproj from the GitHub repository you just cloned.
  5. In RStudio, open the index.md file and click Build Book in the Build tab. A new window will open with the homepage for the formatted textbook.
  6. In RStudio, open and edit the 01-chapter-template.Rmd file.
  7. Rename the file for each of your chapters with the following naming convention: 04-collecting-and-editing-data.Rmd. Note that the file starts with the chapter number, uses - between words, and all letters are lowercase.

Working on a chapter without a collaborator

These steps are a typical workflow for if you are the only person working on a chapter without anyone else. Working without a collaborator will allow you to push to your fork without any merge conflicts.

  1. Edit your chapter file with your content in RStudio. If your workflows for creating chapter content live mostly outside of RStudio, then you can copy/paste your Markdown-formatted text, or replace the .Rmd file completely. Save your files locally often.
  2. To see your changes, click on the Knit button in RStudio to generate the HTML content for your Markdown file.
  3. When you have completed a portion of work that you would like to preserve, commit and push back to GitHub using your Git-Bash or Terminal.

Working with one or more collaborators

If you are working with a collaborator (or a few), you can manage merge conflicts by using "branches". In this case, two contributors will work in one repository by adding them as collaborators in GitHub. Then, a branch can be made for each collaborator while they work. When a new branch is ready to be merged with the main branch, a pull request can be made to review and accept the changes.