Skip to content

git-dct

Release Python Downloads License
Build Bugs Code Smells Coverage Lines of Code Quality Gate Status
pre-commit Commitizen friendly gcil pre-commit-crocodile

Git development CLI tools for daily usage


Git aliases configurations

Sources / alias.gitconfig
#####
# git-dct: Git development CLI tools for daily usage
##
# Author: Adrian DC
# Email: radian.dc@gmail.com
# License: Apache License 2.0
# Sources: https://gitlab.com/RadianDevCore/tools/git-dct
# Warning: Generated configuration maintained automatically, do not edit
###

[alias]

    #####
    ## git-dct: profiles/gitconfig/alias/add
    ###

    # Add files verbosely
    aa = "add -Av"

    # Add files as dry-run only
    an = "add -An"

    # Add files in interactive patch mode
    ap = "add -p"

    # Add files in interactive patch mode and amend to the current commit
    acae = "! \
        git add -Ap \
         && git commit --amend --no-edit \
        # \
    "

    #####
    ## git-dct: profiles/gitconfig/alias/branch
    ###

    # Delete branch
    bd = "branch -D"

    # List, create, or delete branches
    br = "branch"

    # List all available branches
    brl = "branch -la"

    # Switch branches or restore working tree files
    ch = "checkout"

    # Create, update and switch to a branch
    sw = "switch -C"

    #####
    ## git-dct: profiles/gitconfig/alias/cherry-pick
    ###

    # Apply the changes introduced by existing commits
    cp = "cherry-pick"

    # Abort the cherry-pick operation in progress
    cpa = "cherry-pick --abort"

    # Continue the cherry-pick operation in progress
    cpc = "cherry-pick --continue"

    # Skip the cherry-pick operation in progress
    cps = "cherry-pick --skip"

    # Git fetch path and cherry-pick commits
    fcp = "dct-tools-git-fcp"

    #####
    ## git-dct: profiles/gitconfig/alias/commit
    ###

    # Commit changes to the repository
    c = "commit"

    # Amend changes to the current commit
    ca = "commit --amend"

    # Amend changes to the current commit without edition
    cae = "commit --amend --no-edit"

    # Update commit authorship from current user or a commit
    cauthor = "dct-tools-git-cauthor"

    # Commit empty changes to the repository
    ce = "commit --allow-empty"

    # Commit changes to the repository with 'Signed-off-by'
    cs = "commit -s"

    # Reset current commit date to now
    cad = "! git commit --amend --no-edit --date=\"$(date -R)\" #"

    # Amend the last commit with interactively staged changes
    sl = "! \
        git reset HEAD^ \
         && git ap \
         && git cae \
        # \
    "

    #####
    ## git-dct: profiles/gitconfig/alias/describe
    ###

    # Describe Git history relative to tags
    tagdescribe = "describe --always"

    #####
    ## git-dct: profiles/gitconfig/alias/diff
    ###

    # Show changes between commits and sources with all differences highlighted
    diffall = "diff --color --submodule=diff --ws-error-highlight=context,new,old"

    # Show changes between commits and sources with only char-level differences
    diffc = "diff --color-words=."

    # Show changes between commits and sources with only word-level differences
    diffw = "diff --color-words"

    # Git history with remote comparator
    st = "stat"

    # Git history with remote comparator
    stat = "dct-tools-git-stat"

    # Show changes in sources with HEAD (or a commit)
    di = "! \
        git diff --name-status \"${1:-HEAD}\" \
         && git ls-files --others --exclude-standard | awk '{print \"U       \" $0}' \
        # \
    "

    #####
    ## git-dct: profiles/gitconfig/alias/fetch
    ###

    # Download references and objects from remotes
    f = "fetch"

    # Git fetch with interactive selection
    fe = "dct-tools-git-fe"

    # Git fetch and reset sources with interactive selection
    fr = "fe --reset"

    # Git fetch with tags and reset sources with interactive selection
    ftr = "fe --reset --tags"

    #####
    ## git-dct: profiles/gitconfig/alias/interfaces
    ###

    # Fetch all branches and show complete history in gitk
    k = "! \
        if ! git fetch --all --prune; then \
          true; \
        fi \
         && gitk --all \
         & sleep 1 \
        # \
    "

    # Fetch all branches and show complete history in tig
    tig = "! \
        if ! git fetch --all --prune; then \
          true; \
        fi \
         && tig --all --submodule \
        # \
    "

    #####
    ## git-dct: profiles/gitconfig/alias/log
    ###

    # Show commits logs in oneline simple view without decorators
    l = "log --abbrev-commit --no-decorate --pretty=oneline"

    # Show commits logs in oneline simple view
    lo = "log --abbrev-commit --pretty=oneline"

    #####
    ## git-dct: profiles/gitconfig/alias/merge
    ###

    # Run merge conflicts resolution tools
    mt = "mergetool"

    #####
    ## git-dct: profiles/gitconfig/alias/push
    ###

    # Push references and objects to remotes
    p = "push"

    # Force push references and objects to remotes
    pf = "push -f"

    # Git push with interactive selection
    pu = "dct-tools-git-pu"

    # Git push tags with interactive selection
    put = "pu -t"

    #####
    ## git-dct: profiles/gitconfig/alias/rebase
    ###

    # Abort current rebase operation and reset HEAD to the original state
    ra = "rebase --abort"

    # Git rebase with interactive selection
    rb = "dct-tools-git-rb"

    # Git rebase local commits with interactive selection
    rbl = "rb --local"

    # Continue the rebasing process after merge conflict resolutions or commit amends
    rc = "rebase --continue"

    # Edit the todo list during an interactive rebase
    re = "rebase --edit-todo"

    # Skip the current patch during a rebasing process
    rs = "rebase --skip"

    # Interactive rebase of the last N commits (default 5)
    r = "! git rebase -i \"HEAD~${1:-5}\" #"

    # Edit through rebase the last N commits (default 5)
    redit = "! GIT_SEQUENCE_EDITOR=\"sed -i -e \\\"s/pick/edit/g\\\"\" git rebase -i \"HEAD~${1:-5}\" #"

    # Interactive rebase from commit reference
    rf = "! git rebase -i \"${1}^\" #"

    # Edit through rebase from commit reference
    rfedit = "! GIT_SEQUENCE_EDITOR=\"sed -i -e \\\"s/pick/edit/g\\\"\" git rebase -i \"${1}\" #"

    #####
    ## git-dct: profiles/gitconfig/alias/remote
    ###

    # List the repositories remotes with their URL
    rv = "remote -v"

    #####
    ## git-dct: profiles/gitconfig/alias/reset
    ###

    # Reset history and sources to the last fetched commit
    rhf = "reset --hard FETCH_HEAD"

    # Reset history and sources to the current commit
    rhh = "reset --hard HEAD"

    # Reset history only to the previous commit
    ri = "reset HEAD^"

    # Reset history and sources to the previous commit
    ro = "reset --hard HEAD^"

    # Reset history and sources to a specific commit
    rt = "reset --hard"

    #####
    ## git-dct: profiles/gitconfig/alias/revert
    ###

    # Revert changes of the specified commit (default: HEAD)
    revertf = "! git revert --no-edit \"${1:-HEAD}\" #"

    # Revert the current commit interactively
    rl = "! \
        git revert -n HEAD \
         && git commit -m 'Revert' \
         && git reset HEAD^ \
         && git add -p \
        # \
    "

    #####
    ## git-dct: profiles/gitconfig/alias/show
    ###

    # Show commit with all differences highlighted
    shall = "show --color --submodule=diff --ws-error-highlight=context,new,old"

    # Show commit with full author, commiter and dates details
    shf = "show --find-renames --pretty=fuller"

    # Show commit with only names and status of changed files
    shm = "show --find-renames --name-status"

    #####
    ## git-dct: profiles/gitconfig/alias/stash
    ###

    # Stash the changes in a dirty working directory away
    s = "stash"

    # Remove all the stash entries
    sc = "stash clear"

    # Interactively select hunks to be stashed
    sp = "stash -p"

    # Extract last stash state to the current working tree
    spop = "stash pop"

    # Reset and stash changes
    cl = "! \
        git reset --hard HEAD \
         && git su \
        # \
    "

    # Abort cherry-pick, abort am, reset and stash changes
    cla = "! \
        git cherry-pick --abort 2>/dev/null \
         && git am --abort 2>/dev/null \
         && git reset --hard HEAD \
         && git su \
        # \
    "

    # Stash changes including untracked files
    su = "! \
        git stash \
         && if git stash -u >/dev/null 2>&1; then \
              git ls-files --exclude-standard --others -z | xargs -0 rm -f; \
            fi \
        # \
    "

    #####
    ## git-dct: profiles/gitconfig/alias/submodule
    ###

    # Show the status of the submodules
    sm = "submodule status"

    # Initialize the submodules recorded in the sources
    smi = "submodule init"

    # Synchronize, initialize and update submodules recursively
    smu = "! \
        git submodule sync --quiet --recursive \
         && git submodule update --init --recursive \
        # \
    "

    #####
    ## git-dct: profiles/gitconfig/alias/tag
    ###

    # Clean all tags automatically
    clean-tags = "! git tag | grep -v -- \"${1:-^$}\" | xargs git tag -d; #"