Skip to content

Presentation on rewriting git history - #372

Open
ThierryO wants to merge 2 commits into
mainfrom
rewrite
Open

ThierryO wants to merge 2 commits into
mainfrom
rewrite

Conversation

@ThierryO

@ThierryO ThierryO commented Mar 4, 2026

Copy link
Copy Markdown
Member

Description

The presentation of a BMK talk

Task list

  • My tutorial or article is placed in a subfolder of tutorials/content/
  • The novel tutorial has a meaningful name, in relation to the content of the tutorial.
  • The filename of my tutorial or article is index.md. In case of an Rmarkdown tutorial I have knitted my index.Rmd to index.md (both files are pushed to the repo).
  • yaml header:
    • (recommended) I am included as author in the authors yaml tag, using [MY_AUTHOR_ID]. An author information file exists in <tutorials>/data/authors/<author>.toml.
    • I have added categories to the YAML header and my category tags are from the list of categories.
    • I have included meaningful and applicable tags (i.e. keywords) in the YAML header to improve the visibility of the new tutorial (see the tags listed in the tutorials website side bar).
    • The date is in format YYYY-MM-DD and adjusted.
  • (recommended) I have previewed this PR locally (see steps below; ask previous contributors for help) and confirmed that the new content renders as expected.

Previewing the pull request

Thanks to GitHub Actions, an artifact (=zip file) of the rendered website is automatically created for each pull request.
This provides a way to preview how these updates will look on the website, useful to contributors and reviewers.

Instructions to preview the updated website

  1. On the PR page, you can find a "details" link under "checks - On PR, build the site and ...". Go there, click on the top link in the left sidebar ("Summary"), and download the generated artifact at the bottom of the page.
  2. Decompress it into a target directory, e.g. Downloads/tutorials_preview.
  3. To preview the website, use a program which can serve http sites on your local machine. One such option is the servr package in R: & '\C:\Program Files\R\R-4.4.2\bin\Rscript.exe' -e "servr::httd('./tutorials_preview')" -p8887 (make sure to adjust the path to your Rscript.exe; on Linux, simply use Rscript -e [...]).
  4. Point your browser to http://localhost:8887.
  5. Review the updated website. As a contributor, you can push extra commits to update the PR. As a reviewer, you can accept/refuse/comment the PR.

Note: for step 3, you can use any other simple HTTP server to serve the current directory, e.g. Python http.server: python -m http.server 8887 --bind localhost --directory path/to/tutorials_preview

Alternative: Locally Building the Site

Alternatively, you can build the entire site locally (see the README for instructions); the Hugo preview server will update changes on the fly.
This requires Hugo to be installed on your computer.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new tutorial section for “Rewriting git history”, implemented as a Quarto Reveal.js presentation (with a bundled flandersqmd revealjs extension) and an index.md page linking to the rendered presentation.html.

Changes:

  • Add Quarto Reveal.js presentation source (presentation.qmd) explaining git history rewriting workflows.
  • Add a Quarto project config and post-render script to produce/clean presentation artifacts.
  • Vendor a custom Quarto Reveal.js extension (_extensions/inbo/flandersqmd) with CSS/filters/fonts/images.

Reviewed changes

Copilot reviewed 11 out of 33 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
content/tutorials/git_rewrite_history/presentation.qmd New slide deck content (dot graphs + git guidance).
content/tutorials/git_rewrite_history/index.md Tutorial landing page linking to the generated HTML presentation.
content/tutorials/git_rewrite_history/_quarto.yml Quarto project config for rendering the presentation.
content/tutorials/git_rewrite_history/post_render.R Post-render clean-up/copy script for the generated presentation artifacts.
content/tutorials/git_rewrite_history/_extensions/inbo/flandersqmd/* Bundled Reveal.js extension assets (SCSS/CSS, Lua filters, fonts/images, CSL).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +429 to +430
1. make sure you have checkout the correct branch
- `git checkout my_feature`

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling/grammar: “have checkout” should be “have checked out”.

Copilot uses AI. Check for mistakes.
Comment on lines +464 to +465
- apply the changes locally as describe in the previous chapter
- a simple `git push` will fail because of a diverging history

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling/grammar: “as describe” should be “as described”.

Copilot uses AI. Check for mistakes.
border-left-color: var(--flandersqmd-callout-warning-border);
}

.reveal div.callout.callout-note.warning-style-default .callout-title{

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The selector .reveal div.callout.callout-note.warning-style-default .callout-title looks like a typo (it targets a note callout, not a warning callout). As written, warning callouts may not get the intended title background color; this likely should target .callout-warning and the standard callout style class.

Suggested change
.reveal div.callout.callout-note.warning-style-default .callout-title{
.reveal div.callout.callout-warning.callout-style-default .callout-title{

Copilot uses AI. Check for mistakes.
- apply the changes locally as describe in the previous chapter
- a simple `git push` will fail because of a diverging history
- you must use `git push --force` or `git push -f`
- be carefull because you can't undo that

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: “carefull” should be “careful”.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +12
resources$contributes$format$revealjs[["format-resources"]] |>
basename() |>
file.remove() -> hide

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basename() |> file.remove() will delete files in the current working directory matching those basenames. If Quarto's post-render runs from the project root, this can accidentally delete source assets if names collide. Safer: construct explicit paths to the files you intend to delete (e.g., within output/) and/or check file.exists() before removal.

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +28
local url_div = pandoc.Div({pandoc.Para({pandoc.Str(this_url)})}, pandoc.Attr("", {"sidebar-url-tussen"}))
ent_logo = pandoc.Div("", { class = "entity-tussen" })
if (this_lang == "nl-BE") then
if (entitycolours == "inbo") then
vl_logo = pandoc.Image("Vlaanderen is wetenschap", "flanders-nl-transparent.png")
ent_logo = pandoc.Image("Instituut voor Natuur- en Bosonderzoek", "inbo-nl-white.png")
ent_logo.attr = {class = "entity-tussen"}
else
vl_logo = pandoc.Image("Vlaanderen, verbeelding werkt", "flanders-nl-intermediate.jpg")
end
vl_logo.attr = {class = "vl-tussen"}
else

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pandoc Lua attributes/classes are set using pandoc.Attr (or by mutating elem.attr.classes), but this filter assigns classes via vl_logo.attr = {class = ...} and passes { class = ... } directly to pandoc.Div(). This likely won't apply the classes (or may error on some Pandoc versions); use pandoc.Attr("", {"vl-tussen"}) / pandoc.Attr("", {"entity-tussen"}) consistently.

Copilot uses AI. Check for mistakes.
::::


## Commiting to current branch

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling: section title should be “Committing” (double ‘m’).

Copilot uses AI. Check for mistakes.
Comment on lines +62 to +85
function display_person (person, i)
res = ""
if is_empty(person.name) then
res = '<h1 class = "missing">!!! flandersqmd.authors element ' .. i .. ' has no name element!!!</h1>'
return res
end
if is_empty(person.name.given) then
res = '<h1 class = "missing">!!! flandersqmd.authors element ' .. i .. ' has no given element under name!!!</h1>'
return res
end
if is_empty(person.name.family) then
res = '<h1 class = "missing">!!! flandersqmd.authors element ' .. i .. ' has no given element under name!!!</h1>'
return res
end
if is_empty(person.email) then
res = pandoc.utils.stringify(person.name.given) .. ' ' .. pandoc.utils.stringify(person.name.family)
else
res = res .. '<a href= "mailto:' .. pandoc.utils.stringify(person.email) .. '" class = "title email">' .. pandoc.utils.stringify(person.name.given) .. ' ' .. pandoc.utils.stringify(person.name.family) .. '</a>'
end
if (is_empty(person.orcid)) then
return res
end
res = res .. '<a href="https://orcid.org/' .. pandoc.utils.stringify(person.orcid) .. '" class="quarto-title-author-orcid"> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8x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GqzAAPxQACqh4ER6uf5MBlkm0X4EGayMfMw/Pr7Bd2gRBZogMFBrv01hisv5jLsv9nLAPIOMnjy8RDDyYctyAbFM2EJbRQw+aAWw/LzVgx7b+cwCHKqMhjJFCBLOzAR6+lXX84xnHjYyqAo5IUizkRCwIENQQckGSDGY4TVgAPEaraQr2a4/24bSuoExcJCfAEJihXkWDj3ZAKy9EJGaEo8T0QSxkjSwORsCAuDQCD+QILmD1A9kECEZgxDaEZhICIzGcIyEyOl2RkgwAAhkmC+eAm0TAAAAABJRU5ErkJggg=="></a>'
return res

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The display_person function builds raw HTML using unescaped values from person.name.*, person.email, and person.orcid, and returns it via pandoc.RawInline('html', ...). If any of these metadata fields contain characters like quotes or <script> tags (for example via flandersqmd.author in the document YAML), they will be injected directly into the generated HTML, enabling cross-site scripting in the rendered tutorial pages. To fix this, avoid concatenating unescaped metadata into HTML strings; instead, construct pandoc element nodes (e.g., Link, Str) so Pandoc escapes content correctly, or at minimum HTML-escape user-provided metadata before concatenation.

Copilot uses AI. Check for mistakes.

@ElsLommelen ElsLommelen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not do a complete review, but I used one of the commands from the presentation a while ago and I noticed some problem with it, so I hope this can be checked and corrected before publishing?

1. go the branch to which you want to add commits
- `git checkout my_feature`
1. rebase the branch you want to add
- `git rebase other_feature`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried these commands some months ago, and I noticed it did not match with the graph on the next page. As I didn't realise this was part of a PR that needed I review, I wrote the following text (in Dutch) directly to the author. So please check this carefully before publishing, because using a wrong command can completely mess up your repo.

The Dutch review: Mijn situatie was dat ik een nieuwe versie van de main aangemaakt had met enkele commits uit een feature branch en nog wat extra commits, en dat ik nu de rest van de feature branch naar het eindpunt van de main wou verschuiven. Gelijkaardig aan pagina's 14 en 15 van je presentatie heb ik dus eerst een checkout van de main gedaan (de branch waarop ik de commits wil toevoegen), en daarna 'git rebase feature' ingegeven (de branch die ik wil verplaatsen). Het resultaat is zeker niet wat ik verwacht had: de feature branch is helemaal niet op de eerdere main (origin/main) gezet, en het lijkt erop dat er eerder een omgekeerde bewerking gebeurd is: vanuit de vorige versie van de main eerst de feature branch toegevoegd, en daarna de main.

Als ik er deze website bij neem, dan geeft die aan dat ik een checkout van mijn feature branch had moeten doen en dan het commando 'git rebase main' uitvoeren, wat net het omgekeerde is van hoe het in je presentatie staat... Je presentatie geeft alles overzichtelijk weer en het klonk logisch, eerlijk gezegd logischer dan ik tot nu toe tegengekomen was (want ik moet het altijd opzoeken omdat ik de logica van de rebase-commando's nog steeds niet goed door heb m.u.v. de interactieve), maar helaas bleek het niet het juiste commando te zijn. 🫣

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants