The Stupid Content Tracker

about | blog | config | notes | github


No, really, look at the man page, thats the full title!

Git Commit - Randall Munroe

1. Useful Resources

2. Tips and Tricks

Nothing yet, but as I remember them, I'll add them here.

3. Configuration

3.1. Global Config

3.1.1. User Profile

    signingkey = 0x882C395C3B28902C
    name = Amlesh Sivanantham (zamlz)
    email = [email protected]

3.1.2. Core

Specify the global ignore and attributes path

    pager = less
    excludesfile = ~/.config/git/ignore
    attributesfile = ~/.config/git/attributes

3.1.3. Initialization Settings

    defaultBranch = main

3.1.4. Commit Settings

    gpgsign = true

3.1.5. Diff Settings

[diff "gpg"]
    textconv = gpg --no-tty --decrypt

Protesilaos Stravrou has an excellent blog post on how to improve the diff view of Elisp and Org-mode. This is done by specifying the xfuncname regex which is used to identify which heading/function the change belongs to. Full blog post is under the 1 section.

[diff "lisp"]
    xfuncname = "^(\\(.*)$"
[diff "org"]
    xfuncname = "^(\\*+ +.*)$"

3.1.6. Pull Settings

    ff = only

3.1.7. GnuPG

    program = gpg

3.1.8. Aliases

These are just useful aliases I've found online

    branches = for-each-ref --sort=-committerdate --format=\"%(color:blue)%(authordate:relative)\t%(color:red)%(authorname)\t%(color:white)%(color:bold)%(refname:short)\" refs/remotes
    root = rev-parse --show-toplevel
    lol = log --graph --decorate --pretty=oneline --abbrev-commit
    lola = log --graph --decorate --pretty=oneline --abbrev-commit --all

3.2. Ignore File

Many programs generate a bunch of garbage files. We don't want git to consider these files. It's often a pain as well to continuously copy .gitignore files around so instead we maintain a global gitignore that is used for all git repos. This is primarily for ignoring files that ONLY my system would generate (i.e. Emacs being the main culprit). There may be some repos where I do want these files checked in and that case we can just --force it.

Emacs garbage (Autosave, Backup, and Compiled Files):


Emacs Local Directory Configuration:


Undo History from Undo Tree:


Python Garbage:


LaTeX Garbage:


3.3. Attributes File

Attributes let us assign file types to specific behaviours within git. In this case, we want these files types to use a special diff settings that we've defined for it in the global configuraiton. (Note, there is a comma there which shouldn't exist but its there because we need to escape the character for org-mode)

*.lisp  diff=lisp
*.el    diff=lisp
*.org   diff=org

Created: 2021-11-13

Emacs 26.1 (Org mode 9.5)