@@ -165,14 +165,174 @@ The `results` folder is *mandatory* to use gblk.
This is this folder that will be tracked by gblk.
## Git Borg Linker - Init
## Git Borg Linker - init
Let's see how gblk works with an example:
```bash
$ mkdir test_gblk; cd test_gblk
$ mkdir results; src
$ mkdir results src
$ git init
```
Initialize gblk to start using it: Done with `gblk init`
\ No newline at end of file
Initialize gblk to start using it: Done with `gblk init`.
This commands create a folder named `.borg` at the root of the project repository. This is where the *`results` folder backups will be stored*.
```bash
gblk-init
Initialize a borg repository inside a git project
USAGE:
gblk init [OPTIONS]
OPTIONS:
-c, --compression <COMPRESSION> The compression to use automatically at each commit if hooks are create [default: lz4]
-h, --help Print help information
-H, --hooks If specified, hooks are created inside `.git/hooks repository`
-m, --mode <MODE> The checkout mode used by gblk automatically after a git checkout: soft or hard. This option is only used if hooks are created. The hard mode will delete every file in your results folder and extract those corresponding to the commit targeted by the checkout [default: hard]
```
Available compressions: no, lz4, zstd, zlib or lzma.
## Git Borg Linker - init {.unnumbered .unlisted}
gblk can optionally create git hooks (with `gblk init` command or `create-hooks`) to automatically execute commands:
- `co`: for *checkout*. It allow to make the git checkout quiet (because it will be reverted)
- `conh`: For *checkout*. It allow to make a checkout without using the hooks. It is useful to bypass the check of unsaved/missing data in the `results` folder. *You have to combine it with `gblk checkout ---mode hard`* to checkout your `results` folder to the new current commit.
- `cnh`: For *commit*. It allows to make a simple git commit without saving your result repository (may lead to data loss)
:::
::: {.callout-note icon=true}
Those aliases are valid only *for the current project*. They can be found in the file `.git/config`
:::
Finally, gblk init creates `.gitignore` and `results/.gitignore` files
::: {layout-ncol=2}
```bash
# .gitignore
.borg
.tmp
.mount
```
```bash
# results/.gitignore
*
!.gitignore
```
:::
## Git Borg Linker - init {.unnumbered .unlisted .big-margin}
Let's init gblk with hooks:
```bash
$ gblk init --hooks
borg repository initialised at .borg
```
Creates an empty `.borg` repository were the backups of the `results` folder will be saved.