aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 8f98b20f4740a3e3e78c4f5e52e8baa16970278c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# ag

*Adam's Git*

`ag` is a trivial shell script to wrap git, adding new commands of use to me
during my professional work. If `ag` doesn't recognize a command, it falls back
to git.

## Usage

The added commands are:

* `ag review`: Accepts a GitLab MR number; fails if the remote is not GitLab.
Pulls the branch associated with that MR number if it exists, displays the
author and description, then displays the diff compared to latest main. After
quitting from the diff, asks whether the MR is approved. If so, approval
is pushed to GitLab, else nothing is done. Then deletes the local branch
and switches back to main or master if available. Requires
[jq](https://jqlang.github.io/jq/) and
[glab](https://gitlab.com/gitlab-org/cli).

* `ag scrub`: If main or master exists (checked in that order), switches to it,
deletes all other local branches, and pulls latest changes from remote.

* `ag submit`: If on main or master branch, accepts a branch name as an
argument, switches to that branch prefixed with `ajwh/`, commits all changes
(opening `$EDITOR` as usual for commit message), and pushes them to the new
branch. If already on a branch prefixed with `ajwh/`, amend prior commit and
force-push to the current branch. If neither scenario applies, do nothing.

## Motivation

These commands help with workflows I perform during full-time work as a software
engineering manager, and are therefore opinionated procedures. I don't expect
others will get much use from this, but I display it publicly (a) for fun and
(b) because it may inspire others to wrap git for their convenience. We're all
better off automating. ([Within reason!](https://xkcd.com/1205/))