# DP0: how to get a fresh copy of tutorial notebooks?

**URL:** <https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674>\
**Category:** Support\
**Tags:** dp0\
**Created:** [July 15, 2021, 5:33pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674 "2021-07-15T17:33:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![rnikutta](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/rnikutta/32/1683_2.png) [@rnikutta](https://www.rubin.community/u/rnikutta)\
**Post date:** [July 15, 2021, 5:33pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/1 "2021-07-15T17:33:27Z")

</div>

Hi, apologies if that’s documented somewhere already, I couldn’t find info about it…  
But how would I obtain a fresh copy of the most current tutorial NBs, while logged into the JupyterLab NB aspect of RSP? Can I git clone from somewhere, is there another mechanism?  
(To clarify: say I’ve edited myself into some broken state in one of the NBs in /notebooks/tutorial-notebooks/, how do I start from scratch?)

Thank you!  
Robert

---

<div class="post-metadata">

**Author:** ![JuliaGschwend](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/juliagschwend/32/1539_2.png) [@JuliaGschwend](https://www.rubin.community/u/JuliaGschwend)\
**Post date:** [July 15, 2021, 5:53pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/2 "2021-07-15T17:53:35Z")

</div>

Hi! I got to a similar situation and solved it this way:

1. go to terminal inside jupyter lab and go to notebooks directory
2. `git restore 01_Intro_to_DP0_Notebooks.ipynb`; `git pull`

I hope it helps =)

---

<div class="post-metadata">

**Author:** ![rnikutta](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/rnikutta/32/1683_2.png) [@rnikutta](https://www.rubin.community/u/rnikutta)\
**Post date:** [July 15, 2021, 5:58pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/3 "2021-07-15T17:58:39Z")

</div>

Hi @JuliaGschwend Thank you! Before I try: this will overwrite my changes I guess? (I better make some copies…)

---

<div class="post-metadata">

**Author:** ![MelissaGraham](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/melissagraham/32/2549_2.png) [@MelissaGraham](https://www.rubin.community/u/MelissaGraham)\
**Post date:** [July 15, 2021, 5:59pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/4 "2021-07-15T17:59:43Z")

</div>

Thanks @rnikutta for the question and @JuliaGschwend’s suggestion of using the `git restore` command should fix things for you.

I encountered a similar error recently and documented the solutions in [this GitHub Issue thread](https://github.com/rubin-dp0/Support/issues/9#issuecomment-877383155), which might also be of use to you here. It includes instructions for how to keep your changes.

---

<div class="post-metadata">

**Author:** ![rnikutta](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/rnikutta/32/1683_2.png) [@rnikutta](https://www.rubin.community/u/rnikutta)\
**Post date:** [July 15, 2021, 6:13pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/5 "2021-07-15T18:13:15Z")

</div>

Thank you @MelissaGraham !  
In the meantime I also figured out how to just get the latest and freshest copy into a new directory:

```
cd
mkdir my
cd my
git clone https://github.com/rubin-dp0/tutorial-notebooks

```

And now I can navigate in JupyterLab to my/tutorial-notebooks/ and work there. (I’m sure this is documented somewhere, just that I couldn’t find it…)

Thank you!

---

<div class="post-metadata">

**Author:** ![MelissaGraham](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/melissagraham/32/2549_2.png) [@MelissaGraham](https://www.rubin.community/u/MelissaGraham)\
**Post date:** [July 15, 2021, 6:25pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/6 "2021-07-15T18:25:59Z")

</div>

That will get you a new, additional copy of the tutorial-notebooks, yes, but `git clone` into a new directory is not the preferred method in this case. The tutorials in your `my/tutorial-notebooks/` directory will not automatically be updated when we release new versions or new notebooks to the `prod` branch, like the ones in your `/notebooks/tutorial-notebooks/` directory will be. Since the DP0-era RSP is in active development, such updates might happen on weeks-to-months timescales.

This `git clone` option is fine so long as those details are understood, though! And probably you’ll still want to do the `git restore` method in your `/notebooks/tutorial-notebooks/`to undo the broken states of those notebooks.

---

<div class="post-metadata">

**Author:** ![rnikutta](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/rnikutta/32/1683_2.png) [@rnikutta](https://www.rubin.community/u/rnikutta)\
**Post date:** [July 15, 2021, 6:39pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/7 "2021-07-15T18:39:41Z")

</div>

Absolutely, will restore, and will always consider the version in /notebooks/tutorial-notebooks/ as the truth state. Thank you.

---

<div class="post-metadata">

**Author:** ![MelissaGraham](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/melissagraham/32/2549_2.png) [@MelissaGraham](https://www.rubin.community/u/MelissaGraham)\
**Post date:** [August 4, 2021, 9:22pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/8 "2021-08-04T21:22:42Z")

</div>

In order to ensure the contents of your `notebooks/tutorial-notebooks/` directory are up to date, you have several options, but they all start with checking that you have your git user and email set up.

You can check this with :

> `egrep 'email|name' ~/.gitconfig`

If you get nothing back the email and name have not been set. Set them with:

> `git config --global user.email yourEmail@yourdomain`  
> `git config --global user.name GItUsername`

This will allow you to use the options below.

**Option 1.** Fully log out, stop the server, and log back in again. This will automatically refresh the contents of your `notebooks/tutorial-notebooks/` directory. To fully stop your server, use the control panel at [Welcome To The CILogon OpenID Connect Authorization Service](https://data.lsst.cloud/nb/hub/home). Click the red button that says “Stop My Server”.

**Option 2.** However, you will not have the most up-to-date versions of all the notebooks if you have made and saved changes to any of the notebooks (recall that Jupyter auto-saves changes, so just executing the notebook will save a changed version). In other words, `git` will not overwrite your changes to these notebooks. Use `git status` from a terminal command line in the `notebooks/tutorial-notebooks/` directory to see if any files have changed.

If you are in this situation, use the documented the solutions in [this GitHub Issue thread](https://github.com/rubin-dp0/Support/issues/9#issuecomment-877383155) to use `git restore`.

**Option 3.** As a last resort, to completely blow away any changes you’ve made and get a fresh set of all of the tutorial notebooks, use the following in the `notebooks/tutorial-notebooks/` directory:

> `git reset --hard origin/main`  
> `git pull`

Using `git` is the preferred way to make your `tutorial-notebooks/` directory completely refreshed with the most up-to-date versions of the tutorials. However, a final last resort is to delete the entire `tutorial-notebooks` directory, log out and stop the server (see instructions above), and then log back in again.

---

<div class="post-metadata">

**Author:** ![fsklich](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/fsklich/32/1589_2.png) [@fsklich](https://www.rubin.community/u/fsklich)\
**Post date:** [August 6, 2021, 2:10pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/9 "2021-08-06T14:10:48Z")

</div>

Hi Melissa.  
I downloaded an independent copy of the latest w\_2021\_25 set of DP0 notebooks. I reached a halt-point at the step where I started to access the TAP service…  
THENNN, I recalled that I likely will not be able to run these, due to not having a delegate statuses account. That’s fine, just wanted to confirm with you. Am I correct?  
Hope you have the kind of Friday you think you deserve. 😀  
Fred, Dallas, Tx

---

<div class="post-metadata">

**Author:** ![MelissaGraham](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/melissagraham/32/2549_2.png) [@MelissaGraham](https://www.rubin.community/u/MelissaGraham)\
**Post date:** [August 6, 2021, 3:08pm UTC](https://www.rubin.community/t/dp0-how-to-get-a-fresh-copy-of-tutorial-notebooks/5674/10 "2021-08-06T15:08:07Z")

</div>

Hi Fred,  
Yes I can confirm, that is correct.  
Happy Friday to you too! 🎉  
Melissa
