You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/basics/101-132-advancednesting.rst
+69-69Lines changed: 69 additions & 69 deletions
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,67 @@ should be up to you to decide whether you want record something or not --,
50
50
but it is worth repeating: If you modify a subdataset, you will need to save
51
51
this *in the superdataset* in order to have a clean superdataset status.
52
52
53
+
Let's save the modification of the subdataset into the history of the
54
+
superdataset. For this, to avoid confusion, you can specify explicitly to
55
+
which dataset you want to save a modification. ``-d .`` specifies the current
56
+
dataset, i.e., ``DataLad-101``, as the dataset to save to:
57
+
58
+
.. runrecord:: _examples/DL-101-132-103
59
+
:language: console
60
+
:workdir: dl-101/DataLad-101/
61
+
62
+
$ datalad save -d . -m "finished my midterm project" midterm_project
63
+
64
+
.. index::
65
+
pair: save modification in nested dataset; with DataLad
66
+
.. find-out-more:: More on how 'datalad save' can operate on nested datasets
67
+
68
+
In a superdataset with subdatasets, :dlcmd:`save` by default
69
+
tries to figure out on its own which dataset's history of all available
70
+
datasets a :dlcmd:`save` should be written to. However, it can reduce
71
+
confusion or allow specific operations to be very explicit in the command
72
+
call and tell DataLad where to save what kind of modifications to.
73
+
74
+
If you want to save the current state of the subdataset into the superdataset
75
+
(as necessary here), start a ``save`` from the superdataset and have the
76
+
``-d/--dataset`` option point to its root:
77
+
78
+
.. code-block:: bash
79
+
80
+
# in the root of the superds
81
+
$ datalad save -d . -m "update subdataset"
82
+
83
+
If you are in the superdataset, and you want to save an unsaved modification
84
+
in a subdataset to the *subdatasets* history, let ``-d/--dataset`` point to
85
+
the subdataset:
86
+
87
+
.. code-block:: bash
88
+
89
+
# in the superds
90
+
$ datalad save -d path/to/subds -m "modified XY"
91
+
92
+
The recursive option allows you to save any content underneath the specified
93
+
directory, and recurse into any potential subdatasets:
94
+
95
+
.. code-block:: bash
96
+
97
+
$ datalad save . --recursive
98
+
99
+
Let's check which subproject commit is now recorded in the superdataset:
100
+
101
+
.. runrecord:: _examples/DL-101-132-104
102
+
:language: console
103
+
:workdir: dl-101/DataLad-101/
104
+
:emphasize-lines: 14
105
+
106
+
$ git log -p -n 1
107
+
108
+
As you can see in the log entry, the subproject commit changed from the
109
+
first commit hash in the subdataset history to the most recent one. With this
110
+
change, therefore, your superdataset tracks the most recent version of
111
+
the ``midterm_project`` dataset, and your dataset's status is clean again.
112
+
113
+
53
114
This point in time in DataLad-101 is a convenient moment to dive a bit deeper
54
115
into the functions of the :dlcmd:`status` command. If you are
55
116
interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
@@ -92,7 +153,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
92
153
subdataset contains a modification. For this, let's add an empty text file into
93
154
the ``midterm_project`` subdataset:
94
155
95
-
.. runrecord:: _examples/DL-101-132-103
156
+
.. runrecord:: _examples/DL-101-132-105
96
157
:language: console
97
158
:workdir: dl-101/DataLad-101
98
159
@@ -102,7 +163,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
102
163
*within* the subdataset, simply provide a path (relative to your current location)
103
164
to the command:
104
165
105
-
.. runrecord:: _examples/DL-101-132-104
166
+
.. runrecord:: _examples/DL-101-132-106
106
167
:language: console
107
168
:workdir: dl-101/DataLad-101
108
169
@@ -112,7 +173,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
112
173
and provide a path to the subdataset *with a trailing path separator* like
113
174
this:
114
175
115
-
.. runrecord:: _examples/DL-101-132-105
176
+
.. runrecord:: _examples/DL-101-132-107
116
177
:language: console
117
178
:workdir: dl-101/DataLad-101
118
179
@@ -127,7 +188,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
127
188
path to the dataset (without a trailing path separator). This can be used
128
189
to specify a specific subdataset in the case of a dataset with many subdatasets:
129
190
130
-
.. runrecord:: _examples/DL-101-132-106
191
+
.. runrecord:: _examples/DL-101-132-108
131
192
:language: console
132
193
:workdir: dl-101/DataLad-101
133
194
@@ -138,7 +199,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
138
199
the state of the subdataset within the superdataset, you can combine the
139
200
two paths:
140
201
141
-
.. runrecord:: _examples/DL-101-132-107
202
+
.. runrecord:: _examples/DL-101-132-109
142
203
:language: console
143
204
:workdir: dl-101/DataLad-101
144
205
@@ -147,7 +208,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
147
208
Finally, if these subtle differences in the paths are not easy to memorize,
148
209
the ``-r/--recursive`` option will also report you both status aspects:
149
210
150
-
.. runrecord:: _examples/DL-101-132-108
211
+
.. runrecord:: _examples/DL-101-132-110
151
212
:language: console
152
213
:workdir: dl-101/DataLad-101
153
214
@@ -156,7 +217,7 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
156
217
Importantly, the regular output from a :dlcmd:`status` command in the commandline is "condensed" to the most important information by a tailored result renderer.
157
218
You can, however, also get ``status``' unfiltered full output by switching the ``-f``/``--output-format`` from ``tailored`` (the default) to ``json`` or, for the same infos as ``json`` but better readability, ``json_pp``:
158
219
159
-
.. runrecord:: _examples/DL-101-132-108a
220
+
.. runrecord:: _examples/DL-101-132-111
160
221
:language: console
161
222
:workdir: dl-101/DataLad-101
162
223
@@ -172,74 +233,13 @@ interested in this, checkout the :ref:`dedicated Findoutmore <fom-status>`.
172
233
Before we leave this Find-out-more, lets undo the modification of the subdataset
173
234
by removing the untracked file:
174
235
175
-
.. runrecord:: _examples/DL-101-132-109
236
+
.. runrecord:: _examples/DL-101-132-112
176
237
:language: console
177
238
:workdir: dl-101/DataLad-101
178
239
179
240
$ rm midterm_project/an_empty_file
180
241
$ datalad status --recursive
181
242
182
-
Let's save the modification of the subdataset into the history of the
183
-
superdataset. For this, to avoid confusion, you can specify explicitly to
184
-
which dataset you want to save a modification. ``-d .`` specifies the current
185
-
dataset, i.e., ``DataLad-101``, as the dataset to save to:
186
-
187
-
.. runrecord:: _examples/DL-101-132-110
188
-
:language: console
189
-
:workdir: dl-101/DataLad-101/
190
-
191
-
$ datalad save -d . -m "finished my midterm project" midterm_project
192
-
193
-
.. index::
194
-
pair: save modification in nested dataset; with DataLad
195
-
.. find-out-more:: More on how 'datalad save' can operate on nested datasets
196
-
197
-
In a superdataset with subdatasets, :dlcmd:`save` by default
198
-
tries to figure out on its own which dataset's history of all available
199
-
datasets a :dlcmd:`save` should be written to. However, it can reduce
200
-
confusion or allow specific operations to be very explicit in the command
201
-
call and tell DataLad where to save what kind of modifications to.
202
-
203
-
If you want to save the current state of the subdataset into the superdataset
204
-
(as necessary here), start a ``save`` from the superdataset and have the
205
-
``-d/--dataset`` option point to its root:
206
-
207
-
.. code-block:: bash
208
-
209
-
# in the root of the superds
210
-
$ datalad save -d . -m "update subdataset"
211
-
212
-
If you are in the superdataset, and you want to save an unsaved modification
213
-
in a subdataset to the *subdatasets* history, let ``-d/--dataset`` point to
214
-
the subdataset:
215
-
216
-
.. code-block:: bash
217
-
218
-
# in the superds
219
-
$ datalad save -d path/to/subds -m "modified XY"
220
-
221
-
The recursive option allows you to save any content underneath the specified
222
-
directory, and recurse into any potential subdatasets:
223
-
224
-
.. code-block:: bash
225
-
226
-
$ datalad save . --recursive
227
-
228
-
Let's check which subproject commit is now recorded in the superdataset:
229
-
230
-
.. runrecord:: _examples/DL-101-132-112
231
-
:language: console
232
-
:workdir: dl-101/DataLad-101/
233
-
:emphasize-lines: 14
234
-
235
-
$ git log -p -n 1
236
-
237
-
As you can see in the log entry, the subproject commit changed from the
238
-
first commit hash in the subdataset history to the most recent one. With this
239
-
change, therefore, your superdataset tracks the most recent version of
240
-
the ``midterm_project`` dataset, and your dataset's status is clean again.
0 commit comments