gitlab time tracker 1.7.40

gtt

gtt is a fully featured command line interface for GitLab’s time tracking feature. It monitors the time you spent on an issue or merge request locally and syncs it to GitLab. It also allows you to create reports in various formats from time tracking data stored on GitLab.

Location and version:

1
2
3
4
$ which gtt
/local/cluster/bin/gtt
$ gtt --version
1.7.40

help message:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
$ gtt --help
Usage: gtt [options] [command]

Options:
  -V, --version             output the version number
  -h, --help                output usage information

Commands:
  start [project] [id]      start monitoring time for the given project and resource id
  create [project] [title]  start monitoring time for the given project and create a new issue or merge request with the given title
  status                    shows if time monitoring is running
  stop                      stop monitoring time
  resume [project]          resume monitoring time for last stopped record
  cancel                    cancel and discard active monitoring time
  log                       log recorded time records
  sync                      sync local time records to GitLab
  edit [id]                 edit time record by the given id
  delete [id]               delete time record by the given id
  report [project] [ids]    generate a report for the given project and issues
  config                    edit the configuration file in your default editor
  help [cmd]                display help for [cmd]

tutorial

  1. Create personal access token
  2. mkdir -p ~/.local/share/.gtt
  3. Open ~/.local/share/.gtt/config.yml with your favorite text editor
  4. run chmod 600 ~/.local/share/.gtt/config.yml so only you can read/write the file.
  5. File should look like this:
1
2
3
$ cat ~/.local/share/.gtt/config.yml
url: https://gitlab.cgrb.oregonstate.edu/api/v4
token: ********

Replace the ******* with your access token that you just created.

Then, start your time tracking with commands like:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# davised:Linux @ chrom1 in ~ [9:48:07] $ gtt start 'cgrb-biocomputing/cgrb-software' 154
Starting project cgrb-biocomputing/cgrb-software issue #154 at 09:48

# davised:Linux @ chrom1 in ~ [9:48:35]
$ gtt status
Project cgrb-biocomputing/cgrb-software issue #154 is running, started 11 minutes ago (id: EqqmLWpAg)

# davised:Linux @ chrom1 in ~ [9:59:26]
$ gtt stop
Stopping project cgrb-biocomputing/cgrb-software issue #154, started 11 minutes ago (id: EqqmLWpAg)

# davised:Linux @ chrom1 in ~ [9:59:28]
$ gtt sync

You specify the repo, e.g. ‘cgrb-analysts/cgrb-projects-analysts’ and the issue number. You can also create new issues with gtt create [project] [title].

When you run gtt stop and gtt sync, then your time tracking will be uploaded to the appropriate repo issues.

You can create a report like this:

1
gtt report -u davised -e project cgrb-analysts/cgrb-projects-analysts cgrb-biocomputing/cgrb-software

There are other options for reporting, but I found it useful to specify multiple repos and my own user to save processing time.

software ref: https://github.com/kriskbx/gitlab-time-tracker