@@ -9,7 +9,7 @@ In this tutorial, you will learn how you can get only a subset of files and/or f
## Prerequisites
First of all, make sure ``git`` is available on the computer where you want to synchronize your ``~/MAR`` folder with a repository from this GitLab group. You do not necessarily need the latest version, but make sure to have at the very least [version 2.25](https://github.blog/open-source/git/highlights-from-git-2-25/), which comes with ``git sparse-checkout``, a command which you may want to use later.
First of all, make sure ``git`` is available on the computer where you want to synchronize your ``~/MAR`` folder with a repository from this GitLab group. You do not necessarily need the latest version, but make sure to have at the very least [version 2.25](https://github.blog/open-source/git/highlights-from-git-2-25/), which comes with ``git sparse-checkout``, a useful command which will simplify updating your _sparse checkout_.
Second, on the same computer, run this command:
...
...
@@ -59,12 +59,26 @@ git pull origin main
## Updating your repository again
If you did all previous steps correctly, the next time you want to update, you will only need to run the final command from the previous section (while in `~/MAR`).
If you followed all previous steps correctly, the next time you want to update, you will only need to run the final command from the previous section (while in `~/MAR`).
```
git pull origin main
```
## Restoring repository code (undo local changes)
Let us assume you pulled the contents of `src/forMAR/forMAR` from [ESPECES/MAR/stable](https://gitlab.uliege.be/especes/mar/stable) in your `~/MAR` folder, as suggested earlier, and modified a few files in your own `~/MAR/src/forMAR/forMAR` folder to prepare a MAR executable.
For example, you modified `src/forMAR/forMAR/mar_ecrad_mod.f90` or `src/forMAR/forMAR/marmagic_mod.f90` to tune model parameters, or changed `src/forMAR/forMAR/mar_ib_mod.f90` to change the outputs (e.g., to produce hourly outputs instead of daily outputs).
However, you now want to revert these local changes, either to tune a new MAR executable or to update your copy without having conflicts. You can then use the next ``git`` command.
```
git restore src/forMAR/forMAR
```
The syntax is ``git restore [path]`` where ``[path]`` (a mandatory argument) can be either a single file or a whole folder. In the above example, we restore the entirety of ``src/forMAR/forMAR`` from the remote repository.
## Adding other paths to the _sparse checkout_
If you want to expand your _sparse checkout_ to get other parts of a repository, you can edit `.git/info/sparse-checkout` (e.g., with ``vim`` or ``gedit``) in the folder where you initialized ``git`` (`~/MAR`, in this case) and add more paths or patterns. The `.git/info/sparse-checkout` file itself is interpreted by ``git`` more or less in the same way as a ``.gitignore`` file.