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: getting_started/python-client/lesson_6.md
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,25 @@
1
-
# Lesson 6 - Version control: time travel, branching and rebase
1
+
# Lesson 6 - Version control: Time travel, branching, and rebase
2
2
3
-
> **_NOTE:_** from version 10.1.0 the cli command is `tdbpy` instead of `terminusdb`
3
+
> **_NOTE:_** from version 10.1.0 the CLI command is `tdbpy` instead of `terminusdb`
4
4
5
-
In this lesson about version control, we will be doing some git like operation that can let us collaborate and time travel.
5
+
In this lesson about version control, we will be doing some Git like operation that enables collaborate and time travel.
6
6
7
-
## Branch, creating a copy and jump between versions
7
+
## Branch, create a copy and jump between versions
8
8
9
-
Let's follow the Awesome Startup again. Now they are super busy and decided to hire a few contractors to help out in the current project which will last for a few months. They would like to get the contractors details into the database, so they have to make a branch and ask the contractors to "fill in the details" in the branched database.
9
+
We'll be using the Awesome Startup example again. Now the company is super busy and decided to hire a few contractors to help out for a few months. They would like to get the contractor's details into the database, so they want to make a branch of the database and get the contractors to "fill in the details" in this branch.
10
10
11
-
Making a branch is like making a copy of the database. The good thing about this operation is that, if the contractors has does something wrong and accidentally modify the data that they should not be modifying, the changes will only be remained in the branched database. It gives the managers chances to review the changes before adopting the change in the main database.
11
+
Making a branch is like making a copy of the database. The good thing about this operation is that, if a contractor does something wrong and accidentally modifies data that they shouldn't, the changes will only apply in the branched version. It allows managers to review changes before adopting the change in the main database.
12
12
13
-
To make a branch, we can use the `tdbpy branch` or `tdbpy checkout -b` command. The difference is that `tdbpy branch` will create a new branch WITHOUT going (checkout) to that branch, while `tdbpy checkout` is used to go to another branch but with option `-b` you will create that new branch before going there.
13
+
To make a branch, we use the `tdbpy branch` or `tdbpy checkout -b` command. The difference is that `tdbpy branch` will create a new branch WITHOUT going (checkout) to that branch, while `tdbpy checkout` is used to go to another branch. With the option `-b` you will create that new branch before going there.
14
14
15
-
Before we create the branch, let see what we have for now:
15
+
Before creating the branch, let us first see what we have:
16
16
17
17
```
18
18
$ tdbpy branch
19
19
main
20
20
```
21
21
22
-
We only have the `main` branch. The `main` branch is the default branch that is created when you created a new database. Let's create the new barnch:
22
+
We only have the `main` branch. The `main` branch is the default branch that is created when you create a database. Let's create the new branch:
23
23
24
24
```
25
25
$ tdbpy branch contractors
@@ -34,19 +34,19 @@ main
34
34
contractors
35
35
```
36
36
37
-
Now the contractors can add their details with the script [add_contractors.py](add_contractors.py). We add the two contractors in similar manner as adding Ethan in [lesson 4](lesson_4.md) but notice one thing:
37
+
Now the contractors can add their details with a script [add_contractors.py](add_contractors.py). We add the two contractors in similar way as we added Ethan in [lesson 4](lesson_4.md) but notice one thing:
When we connect to the database, we have to specify the branch to be`contractors`.
43
+
When we connect to the database, we have to specify the branch as`contractors`.
44
44
45
45
Now run the script:
46
46
47
47
`$ python add_contractors.py`
48
48
49
-
To verify we did things right, let's see if there is any changes in the current `main` branch, you can see all the logs with:
49
+
To verify we did things right, let's see if there are any changes in the current `main` branch, you can see all the logs with:
50
50
51
51
```
52
52
$ tdbpy log
@@ -88,7 +88,7 @@ Date: 2021-10-15 11:48:29
88
88
89
89
```
90
90
91
-
So the last time we make changes is adding Ethan, the contractors are not added here.
91
+
So the last time we made changes was when we added Ethan. Contractors have not been added.
92
92
93
93
Now let's go to the `contractors` branch:
94
94
@@ -121,9 +121,9 @@ We have a new entry for the log.
121
121
122
122
## Rebase, what is it about?
123
123
124
-
After the `contractors` branch is created and "filled in". Our managers approve the change. Now, we would like to incorporate the changes back to the main branch. For those of you who are familiar with the git workflow will know that we need to perform a merge from the `contractors` branch to the `main` branch. But we are going to do something a bit difference here, using rebase instead of merge.
124
+
After the `contractors` branch is created and "filled in". Our managers approve the change. Now, we would like to incorporate the changes back to the main branch. For those who are familiar with Git workflow, you will know that we need to perform a merge from the `contractors` branch to the `main` branch. But we are going to do something a bit difference here, using rebase instead of merge.
125
125
126
-
Rebase means that we take the changes we made since the branching and will continue from another branch. For example, if we rebase `main` from `contractors` we will continue from what `contractors` is now, i.e. after adding the contractors. This means we have incorporate the change in `contractors` into `main`. For more information about rebase, see the [documentation with git](https://git-scm.com/docs/git-rebase).
126
+
Rebase means that we take the changes we made since the branching and will continue from another branch. For example, if we rebase `main` from `contractors` we will continue from what `contractors` is now, i.e. after adding the contractors. This means that we have incorporated the change in `contractors` into `main`. For more information about rebase, see the [documentation with git](https://git-scm.com/docs/git-rebase).
127
127
128
128
To do it, let's go back to `main` and rebase from `contractors`:
129
129
@@ -156,7 +156,7 @@ Date: 2021-10-15 11:54:21
156
156
157
157
## Reset, time traveling machine
158
158
159
-
Time fries, now the project is done and the contractors has done their jobs and left the company. We have to time travel to the state of the company before the project.
159
+
Time flies, now the project is done and the contractors have done their jobs and left the company. We have to time travel to the state of the company before the project.
160
160
161
161
Let's verify our log again:
162
162
@@ -184,7 +184,7 @@ Date: 2021-10-15 11:48:32
184
184
185
185
```
186
186
187
-
We would like to keep the commits up to the `Adding Ethan` one, take note of the commit id of that commit. Mine is `8o4vkomwryjogg37u3abojflpzrt0r4`, yours will be different.
187
+
We would like to keep the commits up to the `Adding Ethan` one, take note of the commit id for that commit. Mine is `8o4vkomwryjogg37u3abojflpzrt0r4`, yours will be different.
Hard reset to commit 8o4vkomwryjogg37u3abojflpzrt0r4
194
194
```
195
195
196
-
Notice that it is a hard reset, meaning that the changes after the commit `Adding Ethan` is gone forever! If you are not sure or just want to temporary reset to a previous time, make sure you use `--soft` option. Now let's have a look at the log again:
196
+
Notice that it is a hard reset, meaning that the changes after the commit `Adding Ethan` is gone forever! If you are not sure or just want to temporary reset to a previous time, make sure to use `--soft` option. Now let's have a look at the log again:
197
197
198
198
```
199
199
$ tdbpy log
@@ -213,8 +213,8 @@ Date: 2021-10-15 11:48:32
213
213
214
214
```
215
215
216
-
We are back to where we were again.
216
+
We are back to where we were once more.
217
217
218
218
---
219
219
220
-
[Move on to Lesson 7 - Logical query using triple and WOQL](lesson_7.md)
220
+
[Lesson 7 - Logical query using triple and WOQL](lesson_7.md)
0 commit comments