mirror of
https://github.com/restic/restic.git
synced 2025-10-10 12:10:26 +00:00
Allow --tag and --keep-tag to match untagged snapshots
This commit is contained in:

committed by
Leo R. Lundgren

parent
5571c3f7fd
commit
326fefcd80
@@ -207,6 +207,8 @@ The ``forget`` command accepts the following parameters:
|
||||
boundaries and not relative to when you run the ``forget`` command. Weeks
|
||||
are Monday 00:00 -> Sunday 23:59, days 00:00 to 23:59, hours :00 to :59, etc.
|
||||
|
||||
.. note:: Specifying ``--keep-tag ''`` will match untagged snapshots only.
|
||||
|
||||
Multiple policies will be ORed together so as to be as inclusive as possible
|
||||
for keeping snapshots.
|
||||
|
||||
@@ -234,6 +236,13 @@ To only keep the last snapshot of all snapshots with both the tag ``foo`` and
|
||||
|
||||
$ restic forget --tag foo,bar --keep-last 1
|
||||
|
||||
To ensure only untagged snapshots are considered, specify the empty string '' as
|
||||
the tag.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ restic forget --tag '' --keep-last 1
|
||||
|
||||
All the ``--keep-*`` options above only count
|
||||
hours/days/weeks/months/years which have a snapshot, so those without a
|
||||
snapshot are ignored.
|
||||
|
@@ -165,12 +165,10 @@ command does that:
|
||||
create exclusive lock for repository
|
||||
modified tags on 1 snapshots
|
||||
|
||||
Note the snapshot ID has changed, so between each change we need to look
|
||||
up the new ID of the snapshot. But there is an even better way, the
|
||||
``tag`` command accepts ``--tag`` for a filter, so we can filter
|
||||
snapshots based on the tag we just added.
|
||||
|
||||
So we can add and remove tags incrementally like this:
|
||||
Note the snapshot ID has changed, so between each change we need to look up the
|
||||
new ID of the snapshot. But there is an even better way - the ``tag`` command
|
||||
accepts a filter using the ``--tag`` option, so we can filter snapshots based
|
||||
on the tag we just added. This way we can add and remove tags incrementally:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
@@ -189,6 +187,14 @@ So we can add and remove tags incrementally like this:
|
||||
$ restic -r /srv/restic-repo tag --tag NL --add SOMETHING
|
||||
no snapshots were modified
|
||||
|
||||
To operate on untagged snapshots only, specify the empty string ``''`` as the
|
||||
filter value to ``--tag``. The following command will add the tag ``OTHER``
|
||||
to all untagged snapshots:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ restic -r /srv/restic-repo tag --tag '' --add OTHER
|
||||
|
||||
Under the hood
|
||||
--------------
|
||||
|
||||
|
Reference in New Issue
Block a user