Implement CLI command for tagging
This commit is contained in:
parent
b802e1eb9d
commit
95355befb4
41
how_to/Change_20.md
Normal file
41
how_to/Change_20.md
Normal file
@ -0,0 +1,41 @@
|
||||
- tag: Implement CLI command
|
||||
|
||||
Now that we have branching history we have some OIDs we need to keep track of.
|
||||
Assume we have two branches (continuing from the example we had for `checkout`):
|
||||
```
|
||||
o-----o-----o-----o-----@-----@-----@
|
||||
^ \ ^
|
||||
first commit ----$-----$ 6c9f80a187ba39b4...
|
||||
^
|
||||
d8d43b0e3a21df0c...
|
||||
```
|
||||
|
||||
If we want to switch back and forth between the two "branches" with `checkout`,
|
||||
we need to remember both OIDs, which are quite long.
|
||||
|
||||
To make our lives easier, let's implement a command to attach a name to an OID.
|
||||
Then we'll be able to refer to the OID by that name.
|
||||
|
||||
The end result will look like this:
|
||||
```
|
||||
$ # Make some changes
|
||||
...
|
||||
$ ugit commit
|
||||
d8d43b0e3a21df0c845e185d08be8e4028787069
|
||||
$ ugit tag my-cool-commit d8d43b0e3a21df0c845e185d08be8e4028787069
|
||||
$ # Make more changes
|
||||
...
|
||||
$ ugit commit
|
||||
e549f09bbd08a8a888110b07982952e17e8c9669
|
||||
|
||||
$ ugit checkout my-cool-commit
|
||||
or
|
||||
$ ugit checkout d8d43b0e3a21df0c845e185d08be8e4028787069
|
||||
```
|
||||
|
||||
The last two commands are equivalent, because "my-cool-commit" is a tag that
|
||||
points to d8d43b0e3a21df0c845e185d08be8e4028787069.
|
||||
|
||||
We will implement this in a few steps. The first step is to create a CLI
|
||||
commmand that call the relevant command in the base module. The base module does
|
||||
nothing at this stage.
|
Loading…
Reference in New Issue
Block a user