Skip to content

Commit

Permalink
Merge pull request #6 from unsw-edu-au/contribute
Browse files Browse the repository at this point in the history
Bringing over what I have in Contribute chapter for now!
  • Loading branch information
jenrichmond authored May 21, 2024
2 parents 03c8b13 + 2cee4d6 commit 95ff7dd
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 8 deletions.
2 changes: 1 addition & 1 deletion book/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/.quart/_site/
*.pdf
.DS_Store
_book/
.Rproj.user
.Rhistory
.RData
Expand All @@ -16,5 +17,4 @@ index.tex
docs/
.quarto/
.DS_Store

/.quarto/
100 changes: 93 additions & 7 deletions book/contributing.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ This resource is created in mind so that the community that uses it, can also co

Importantly, **all skill levels** are welcome to contribute, even if you think your skills are not up to scratch - this is what this guide is for!

### GitHub Workflow



### Hello Quarto!

This book is built by [Quarto](https://quarto.org/) which is an open source, cross-language publishing system that allows users to build beautiful things from blogs, to websites and books!
Expand All @@ -18,11 +14,100 @@ You can learn more about the capabilities of Quarto in [this talk](https://www.y

Let's first make sure we the latest version of [Quarto](https://quarto.org/docs/get-started/) installed.

### Quarto Workflow
### GitHub Workflow

Let’s talk about the Git/GitHub part of the workflow. Git is a **version control** system. It that **tracks changes in our code** that generated this book and helps us **coordinate our collaborative edits**.

Git monitors the changes in a project directory a.k.a **repository** or "repo". There are two types of repositories:

- **Local** repository: This is a project directory that exists _locally_ in your computer than git is actively watching over.

- **Remote** repository: This is a **synced** copy of your local repo. The [remote repo](https://github.com/unsw-edu-au/r4psych) for this book lives on GitHub. GitHub **centralises** our collaborative efforts. It provides a platform for the community to make a local copy of the book, create changes and introduce them back to the remote repository. GitHub also acts as the hosting service for the book itself which is also a big bonus for us.

#### Sign up to GitHub

Start by getting yourself an account at GitHub [by signing up here](https://github.com/signup)


#### Install git

Follow [these instructions](https://happygitwithr.com/install-git) from "Happy Git with R" to install git to your computer. There are specific instructions for different operating systems.

#### Install a git client

Traditionally, git has been used in the shell terminal. This is the 'back-end' of the computer and you can interact with your computer using code. This means that you have to type out commands to tell git what to do. This method can become a little overwhelming when you are starting out because you have to learn all the different commands.

If you are starting out with git and GitHub, we suggest using a git client like [Github Desktop](https://desktop.github.com/), however it is limited to only to Windows and Mac. If you use Linux, [GitKraken](https://www.gitkraken.com/git-client) is also a great alternative.

There are many [git clients to choose from](https://git-scm.com/downloads/guis). Once you start to get the hang on things, all of these clients are much of the same and its a matter of personal preference.

If you are an RStudio user, there is a [git tab that is built-in](https://jennybc.github.io/2014-05-12-ubc/ubc-r/session03_git.html#configurerstudio) to the interface, its features are more simplified than the previously mentioned clients but does the basic commands that we will talk about next.

::: {.callout-note}
For the rest of the chapter, we will focus on using Github Desktop, but the main git commands should translate to whichever client you are using.
:::

#### Cloning: make a local copy

Now that we have all the installation out of the way, we can get started!

Lets first get you a local copy of the book onto your computer by "cloning" the repository

Head over to the [remote repo for the book](https://github.com/unsw-edu-au/r4psych):

1. Click on the big green button that says **Code**

![](images/remote_repo.png)

Here you will find a drop-down menu showing different methods of cloning the code from the remote repo.

We will **stick with the default option of using HTTPS** a.k.a. cloning by using the URL of the remote repo.

3. Click on the copy URL button (The stacked squares icon)

## Book Structure
4. Navigate to Github Desktop and click on the first drop down menu from the left. Here you will find the **Add** button.

![](images/add_repo.png)

5. Click on **Add** and then **Clone Repository**

6. Click on the **URL** option and paste in the URL of this book's remote repo e.g. **https://github.com/unsw-edu-au/r4psych**

7. Under **Local Path**, you can choose where you want to place this cloned repo. Avoid putting your repos in Cloud services such as Dropbox or Google Drive. These can sometimes interfere with git's ability to track your changes.

8. Finally, click **Clone** and let git do the work! It will copy everything that is in the remote repo and bring it down locally on your computer!

9. Navigate to the local path where you told git to clone to in Step 7 and check out the directories. You will learn more about these in [Book Structure](#sec-bookstructure)

#### Branches

We will work in branches so as to not overwrite each other’s work and have a systematic way in introducing new contributions to the book. Coordinating collaboratives changes on branches is what GitHub does best.

The `main` branch will be the current approved version of the book. The `main` branch is what displays at https://unsw-edu-au.github.io/r4psych/

A nice clean workflow with branches is to consider them temporary. You pull the most recent from `main`, you **create a branch locally**, you make your edits, you commit regularly, you push regularly to github.com, and then you create a pull request for it to be merged into main, and when it’s approved the branch is deleted on github.com and you also delete it locally. That’s the workflow we’ll walk through here. A great resource on GitHub setup and collaboration is Happy Git with R, which includes fantastic background philosophy as well as bash commands for setup, workflows, and collaboration.

The following assumes you’ve completed the initial setup from the previous chapter.

#### Fetch the latest version

#### Stage and add your changes

#### Push your work to remote











### Quarto Workflow

## Book Structure {#sec-bookstructure}

## Book Practices and Conventions

Expand All @@ -32,7 +117,8 @@ Let's first make sure we the latest version of [Quarto](https://quarto.org/docs/

### Additions

## Contribution Review
## Submit a pull request




Expand Down
Binary file added book/images/add_repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added book/images/remote_repo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 95ff7dd

Please sign in to comment.