Short names, big time savings – a collection of commands for the git operations you perform most often.
Meaningful and memorable: All of the commands have names that, even though short, make sense... For the most part ;)
The commands are, in short order: dp
, aa
, st
, di
, cm
, pu
and le
.
Read on below to see what they mean and what arguments they take, or skip straight to installation if you are feeling too impatient. (But do go back and read how to use them afterwards if you end up installing them right away.)
dp [<path>...]
– diff pending, optionally limited to one or more files or directoriesWhen you look at what changes you want to stage for commit, you type dp
.
dp
calls git diff
with the optionally provided arguments.
aa [<pathspec>...]
– add all, optionally limited to one or more directoriesWhen you want to stage everything, or everything in certain directories,
for commit, you type aa
or aa <directory>...
respectively.
aa
calls git add -A
with the optionally provided arguments.
st [<pathspec>...]
– status, optionally limited to one or more files or directoriesMy workflow usually goes, write some code, stage some code, research something, test the changes, write some code, stage some code, and so on.
Every now and then between writing, staging, etc, I look at what
I've staged for commit so far, and what has not yet been staged.
For the high-level bird's eye view of that there is st
.
st
calls git status
with the optionally provided argument.
di [<path>...]
– diff staged, optionally limited to one or more files or directoriesPrior to committing, and also now and then while still working on the code, it is very useful to review what you are about commit, both to ensure that you are about to commit what you think you are about to commit, and in order to write useful commit messages that accurately describe the changes.
di
shows the diff for the staged changes against HEAD.
di
calls git diff --cached
with the optionally provided argument.
cm <message>
– commit with messageWhen it comes time to commit, you have cm
.
cm
calls git commit -m
with the provided argument.
pu [--tags | -f]
– push, optionally including refs under refs/tags, or force pushFinally you push with pu
.
pu
calls git push
with the optionally provided flag.
le
– number of commitsAmong all of the aliases, this is the only one that doesn't match
the meaning with its name. I would have named this alias as I initially
did; nc
, if it wasn't for the fact that the netcat command on a lot
of systems is named nc
already. And when I used aliases, I didn't feel
like having to remember to type \nc
when I wanted netcat, nor did I
and nor do I feel like typing out the full path to netcat either, e.g.
/usr/bin/nc
. So I took the "l" for "log" and the "e" for the -e
flag.
le
calls git shortlog -se
.
Precompiled binaries will be provided in the future, but for now you'll need to have the Rust toolchain installed. If you don't have the Rust toolchain installed already, head over to https://rustup.rs/ and follow the instructions there and then come back here.
Once you have the Rust toolchain installed, simply run:
bash
cargo install repotools
If you find this project useful, remember to star it on GitHub.