Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


name: sphinx
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

env:
DEFAULT_BRANCH: "main"
Expand Down Expand Up @@ -100,14 +100,15 @@ jobs:
- name: Generate PDF
if: ${{ env.GENERATE_PDF == 'true' }}
run: |
pip install https://github.com/rkdarst/sphinx_pyppeteer_builder/archive/refs/heads/main.zip
#pip install https://github.com/rkdarst/sphinx_pyppeteer_builder/archive/refs/heads/main.zip
pip install sphinx_pyppeteer_builder
make pyppeteer
mv _build/pyppeteer/*.pdf _build/dirhtml/${PDF_FILENAME}

# Stage all deployed assets in _gh-pages/ for simplicity, and to
# prepare to do a multi-branch deployment.
- name: Copy deployment data to _gh-pages/
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
run:
rsync -a _build/dirhtml/ _gh-pages/

Expand All @@ -116,21 +117,21 @@ jobs:
# https://github.com/coderefinery/gh-pages-multibranch
- name: gh-pages multibranch
uses: coderefinery/gh-pages-multibranch@main
if: ${{ github.event_name == 'push' && env.MULTIBRANCH == 'true' }}
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && env.MULTIBRANCH == 'true' }}
with:
directory: _gh-pages/
default_branch: ${{ env.DEFAULT_BRANCH }}
publish_branch: gh-pages

# Add the .nojekyll file
- name: nojekyll
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
run: |
touch _gh-pages/.nojekyll

# Save artifact for the next step.
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
with:
name: gh-pages-build
path: _gh-pages/
Expand All @@ -142,13 +143,13 @@ jobs:
runs-on: ubuntu-latest
needs: build
# This if can't use the env context - find better way later.
if: ${{ github.event_name == 'push' }}
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
permissions:
contents: write

steps:
- uses: actions/download-artifact@v4
if: ${{ github.event_name == 'push' && ( env.MULTIBRANCH == 'true' || github.ref == format('refs/heads/{0}', env.DEFAULT_BRANCH )) }}
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && ( env.MULTIBRANCH == 'true' || github.ref == format('refs/heads/{0}', env.DEFAULT_BRANCH )) }}
with:
name: gh-pages-build
path: _gh-pages/
Expand All @@ -162,7 +163,7 @@ jobs:
# https://github.com/peaceiris/actions-gh-pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && ( env.MULTIBRANCH == 'true' || github.ref == format('refs/heads/{0}', env.DEFAULT_BRANCH )) }}
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && ( env.MULTIBRANCH == 'true' || github.ref == format('refs/heads/{0}', env.DEFAULT_BRANCH )) }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
89 changes: 85 additions & 4 deletions content/browsing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,18 @@ own changes in the next episode.

## GitHub, VS Code, Command line, and more

We offer **three different paths** for this exercise:
We offer **four different paths** for this exercise:
- **GitHub** (this is the one we will demonstrate on day 1)
- **VS Code** (if you prefer to follow along using an editor; we will
return to this on day 2)
- **RStudio** (if you prefer to follow along using an editor; we will
return to this on day 2)
- **Command line** (for people comfortable with the command line; you
will see more of this on day 2)

In the future we'll add more paths, for example Jupyter and RStudio
In the future we'll add more paths, for example Jupyter
([contributions welcome!](https://github.com/coderefinery/git-intro/issues/458)).


## Creating a copy of the repository by "forking"

A {term}`repository` is a collection of files in one directory tracked
Expand Down Expand Up @@ -66,7 +67,7 @@ become important later, when we make our own changes.
1. You should shortly be redirected to your copy of the repository
**USER/recipe-book**.

At all times you should be aware of if you looking at *your* repository
At all times you should be aware of if you are looking at *your* repository
or the *CodeRefinery {term}`upstream`* repository.
* Your repository: https://github.com/**USER**/recipe-book
* CodeRefinery upstream repository: https://github.com/**cr-workshop-exercises**/recipe-book
Expand Down Expand Up @@ -115,6 +116,22 @@ need to have forked the repository as described above.
HTTPS, depending on your setup.
1. Change to that directory: `cd recipe-book`
::::

::::{group-tab} RStudio
You need to have forked the repository as described above.

We need to start by making a copy of this repository locally.

1. Start RStudio.
1. Go to "File" → "New Project..."
1. Choose "Version Control", and then "Git"
1. In the "Repository URL" field, paste in this URL: `https://github.com/USER/recipe-book`, where
`USER` is your username. You can copy this from the browser.
1. You can change the "Project directory name" if you want but that is not mandatory.
By default, it will use the repository name from the URL.
1. Click "Create Project"
::::

:::::


Expand Down Expand Up @@ -204,6 +221,16 @@ $ git log --oneline
```
::::

::::{group-tab} RStudio
This can be done from "History", in the top right panel of explorer. This will open a pop-up window
from which you can explore the history of commits.
:::{figure} img/browsing/history_RStudio.png
:alt: Screenshot of RStudio of where to find the commit history
:width: 100%
:class: with-border
:::
::::

:::::


Expand Down Expand Up @@ -240,8 +267,20 @@ $ git graph
If not, you can use the basic command:
```console
$ git log --graph --oneline --decorate --all
```
::::

::::{group-tab} RStudio
This can be viewed in the same "History" tab that we just looked at. The branch network can be seen on the left of
the commit list, and individual commits can be clicked to see the person who committed and what changes they did.

:::{figure} img/browsing/network_RStudio.png
:alt: Screenshot of RStudio of where to find the commit history
:width:100%
:class: with-border
:::

::::
:::::


Expand Down Expand Up @@ -276,6 +315,25 @@ $ git log sides/guacamole.md
```
::::

::::{group-tab} RStudio
Open the file in the main editor window, and navigate to the "Version control" menu (Git icon in the toolbar right
below the main menu bar), then select "Log of guacamole.md"
:::{figure} img/browsing/file-history_RStudio_menu.png
:alt: Screenshot of RStudio of where to find the file history
:width: 100%
:class: with-border
:::

This will open a pop-up window showing all commits that modified the "Guacamole.md" file.

:::{figure} img/browsing/file-history_RStudio_view.png
:alt: Screenshot of RStudio showing history of the guacamole.md file
:width: 100%
:class: with-border
:::

::::

:::::


Expand Down Expand Up @@ -325,6 +383,18 @@ $ git grep -i salt # case insensitive
```
::::

::::{group-tab} RStudio
Go to Edit → Find in Files... (ctrl+shift+F) and type salt in the Find field. It will by default search for salt in
all files in the recipe-book directory. Press Find button at the bottom of the pop-up window. It will show all
occurrences in every file in a Find in Files tab in the Console panel.

:::{figure} img/browsing/search_RStudio.png
:alt: Screenshot of the Find in Files tab in RStudio showing all "salt" occurrences in every file
:width: 100%
:class: with-border
:::
::::

:::::


Expand Down Expand Up @@ -359,6 +429,17 @@ $ git blame sides/guacamole.md
```
::::

::::{group-tab} RStudio
Open the file in the main editor window, and navigate to the "Version control" menu (Git icon in the toolbar right
below the main menu bar), then select "Blame "guacamole.md" on GitHub". This will open a GitHub page in your
web-browser with the same view as shown in the GitHub tab.
:::{figure} img/browsing/annotate_RStudio.png
:alt: Screenshot of RStudio of where to find the file history
:width: 100%
:class: with-border
:::
::::

:::::


Expand Down
Binary file added content/img/browsing/annotate_RStudio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 content/img/browsing/history_RStudio.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 content/img/browsing/network_RStudio.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 content/img/browsing/search_RStudio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading