Skip to content

Commit

Permalink
git: Use awdur to document and generate git config
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Aug 4, 2024
1 parent 1d88354 commit 4e6b6df
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 3 deletions.
13 changes: 13 additions & 0 deletions dotfiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@ Dotfiles

Some of my dotfiles.

.. grid:: 1 2 2 2
:gutter: 2

.. grid-item-card:: :octicon:`terminal` Bash
:link: /dotfiles/bash
:link-type: doc

.. grid-item-card:: :octicon:`git-branch` Git
:link: /dotfiles/git
:link-type: doc


.. toctree::
:glob:
:hidden:

dotfiles/*
6 changes: 3 additions & 3 deletions dotfiles/bash.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Bash configuration
.PHONY: bash
bash:
test -f $(HOME)/.bashrc || ln -s bashrc $(HOME)/.bashrc
test -L $(HOME)/.bashrc || ln -s $(shell pwd)/bashrc $(HOME)/.bashrc
Aliases
-------
Expand All @@ -30,7 +30,7 @@ I set the following options
shopt -s autocd # If no command found, but matches a directory, cd into it
shopt -s checkjobs # Warn about background jobs before exiting
shopt -s checkwinsize # Update the COLUMNS and LINES environment variables between each command
shopt -s checkwinsize # Update the COLUMNS and LINES environment variables between each command
shopt -s extglob # Enable extended pattern matching features
shopt -s globstar # Enable recursive globbing i.e `./**/*.py`
Expand All @@ -49,7 +49,7 @@ Environment Variables
.. pull-quote::

The search path for the cd command.
This is a colon separated list of directories in which the shell looks for destination directories specified by the cd command.
This is a colon separated list of directories in which the shell looks for destination directories specified by the cd command. -- man(1) bash

This means I can ``cd`` into a project folder from anywhere on my system!

Expand Down
120 changes: 120 additions & 0 deletions dotfiles/git.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
Git
===

.. code-block:: make
:filename: Makefile
.PHONY: git
git:
test -L $(HOME)/.gitconfig || ln -s $(shell pwd)/gitconfig $(HOME)/.gitconfig
Author
------

.. highlight:: none

Setting basic identity details for commits

.. code-block::
:filename: gitconfig
[user]
name = Alex Carney
email = alcarneyme@gmail.com
Aliases
-------

.. code-block::
:filename: gitconfig
[alias]
co = checkout
amend = commit --amend --no-edit # Squash changes into the previous commit
A nice view of a repository's history

.. code-block::
:filename: gitconfig
hist = log --branches --remotes --tags --graph --oneline --decorate
.. code-block::
$ git hist
* 9bbbedca (origin/sphinx-8, sphinx-8) lsp: Drop Sphinx 5.x, add support for Sphinx 8.x
* 44f758bc (HEAD -> develop, upstream/develop, origin/develop) Merge branch 'release' into develop
|\
| * 6a2086c7 (tag: esbonio-vscode-extension-v0.95.1, upstream/release, release) Esbonio VSCode Extension Release v0.95.1
| * 72be1341 (origin/take-2) code: Update changelog
* | fc194b26 Start testing against 3.13
* | 306fbaf9 Bump ruff version
* | 4552ff34 [pre-commit.ci] pre-commit autoupdate
* | 5bce0a3c build(deps): bump semver from 7.6.2 to 7.6.3 in /code
* | d02c69ad build(deps-dev): bump @vscode/vsce from 2.30.0 to 2.31.1 in /code
* | 8de0b24a devenv: Install the latest hatch
* | c96bc561 devenv: Bump NodeJS version
...
A better (for some definition of "better") git status command

.. code-block::
:filename: gitconfig
s = !git status -sb && git --no-pager diff --shortstat
.. code-block::
$ git s
## release...origin/release [ahead 2]
M dotfiles.rst
M dotfiles/bash.rst
?? dotfiles/.#git.rst
?? dotfiles/git.rst
2 files changed, 12 insertions(+), 3 deletions(-)
Credential Helper
-----------------

This tells git to use the `GitHub CLI <https://cli.github.com/>`__ to authenticate when pushing/pulling from GitHub

.. code-block::
:filename: gitconfig
[credential "https://github.com"]
helper =
helper = !gh auth git-credential
Other Options
-------------

.. code-block::
:filename: gitconfig
[commit]
verbose = true
[core]
editor = nvim
[diff]
colorMoved = default
[merge]
conflictstyle = diff3
[pull]
rebase = true
[rerere]
enabled = true
# Used by forge.el
[github]
user = alcarney

0 comments on commit 4e6b6df

Please sign in to comment.