Skip to content

This is Git Xtended, a shell tool that makes it easy to perform recurring actions with Git on a daily basis.

License

Notifications You must be signed in to change notification settings

jprivet-dev/git-xtended

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Xtended

1. Presentation

Git Xtended is a shell tool that makes it easy to perform recurring actions with Git on a daily basis.

gx c demo

It allows :

  • Display in the shell prompt the project status with Git information.

  • Set up documented Git & Bash aliases for recurring actions.

  • Have a commit message formatter (without prepare-commit-msg hook) inspired by the conventional commits.

  • Provide comprehensive and quickly accessible documentation in the shell.

  • Customise options globally or by project.

  • Ensure stability with unit tests.

Tip

Git Xtended does not alter the default operation of Git commands: all Git commands retain their original behaviour.

The features of Git Xtended are based on my experiments with hundreds of aliases, which you can find on my Gist Git and Bash aliases defined and documented in a single .bash_aliases file, with Git auto-completion.

2. Documentation

4. Overview

4.1. GX Help

$ gx

4.2. Prompt with Git information

12:00:00 user@host:~/path/project username(branch) 8≡ 1? 3! c(2 +1 -1) 3↓ 42↑ ⚠️️
$ gx prompt

  # Prompt with Git information :
    username(branch) ... Current Git username & branch
    8≡ ................. All elements from git status
    1? ................. Untracked files
    3! ................. Changes not staged for commit
    c(2 +1 -1) ......... Changes to be committed - c(modified added deleted)
    3↓ ................. Commits behind remote reference branch (origin/main)
    42↑ ................ Commits ahead remote reference branch (origin/main)
    ⚠️️   ................ To many commits behind or to many changes

4.3. Git aliases

$ gx galiases

  # Git aliases :
             log | git l ........................... Show the last 12 commit logs (graphical representation)
                   git ll .......................... Show all commit logs (graphical representation)
                   git lfile <file> ................ Show all commit logs for a specific file (graphical representation)
                   git lmerges ..................... Show all merge logs (graphical representation)
                   git lcount ...................... Number of commits per author
          branch | git b ........................... Simple "branch" alias
                   git recent ...................... Show all local branches ordered by recent commits
                   git previous .................... Quickly switch to the previous branch
                   git new <branch> [<remote>/<b>] . Create and switch on new branch
                   git rename [<branch>] <name> .... Rename one local branch
                   git delete <branch> ............. Delete local branch
                   git deletef <branch> ............ Forcefully delete local branch
                   git deleter <remote> <branch> ... Delete remote branch
        checkout | git ck .......................... Simple "checkout" alias
                   git res [<i>|<path>] ............ Indexed "restore" command (select file with index status instead of path)
                   git sw .......................... Simple "switch" alias
          status | git s ........................... Indexed status list (staged, unstaged, and untracked files)
                   git ss .......................... Simple "status" alias
            diff | git d [<i>|<path>] .............. Indexed "diff" command (select file with index status instead of path)
                   git dd .......................... Simple "diff" alias
                   git dw [<path>] ................. Show changes (ignore whitespace / word diff / without [-...-]{+...+})
                   git ds [<path>] ................. Show changes staged for commit
                   git dsw [<path>] ................ Show changes staged for commit, like 'dw'
                   git oneday ...................... Show changes over the last 24 hours
             add | git a [<i>|<path>] .............. Indexed "add" command (select file with index status instead of path)
                   git all ......................... Add all files (new, modified and deleted)
                   git nm .......................... Add new and modified files, without deleted
                   git md .......................... Add modified and deleted files, without new
          commit | git c [<i>|<path>|all] .......... Indexed "commit" command (select file with index status instead of path)
                   git amend ....................... Modify message of the previous commit
                   git noedit ...................... Modify previous commit without modifying the commit message
           reset | git r ........................... Simple "reset" alias
                   git hard [<commit>] ............. Simple "reset --hard" alias (by default, discard any changes to tracked files, since last commit)
                   git undo ........................ Undo the last commit, while keeping files changes
           clean | git untracked ................... Remove all untracked files
            push | git pushf [<remote> <branch>] ... Push force in safety mode
     cherry pick | git cp .......................... Simple "cherry-pick" alias
            tags | git tlast ....................... Show the most recent tag on the current branch
                   git tlist ....................... Display tags in natural order
          config | git confgx ...................... Show GX git configuration (as '$ gx config')
                   git unset ....................... Remove the line matching the key from config file (local)
                   git unsetall .................... Remove all lines matching the key from config file (local)
                   git edit ........................ Open an editor to modify the specified config file (local)
                   git unsetg ...................... Remove the line matching the key from config file (global)
                   git unsetallg ................... Remove all lines matching the key from config file (global)
                   git editg ....................... Opens an editor to modify the specified config file (global)
            grep | git find <string> ............... Look for specified strings in the tracked files (case sensitive)
    pull request | git pr [<base>] ................. Generate the url to compare and create a PR with the current branch
           stats | git contributors ................ Get the list of contributors for the current repository
Note
More information on Git Xtended Documentation - Git aliases

4.4. Bash aliases

$ gx baliases

  # Bash aliases :
    g ................ Alias with Git autocompletion
    gti .............. Because it could happen to anyone ¯\_(ツ)_/¯
Note
More information on Git Xtended Documentation - Bash aliases

4.5. Commit message formater

$ git c
> git add (1) README.adoc
> & commit ...
--------------------------------------------------
M  README.adoc
--------------------------------------------------
user.name  : user
user.email : user@email.com
--------------------------------------------------
MSG = <type*>(<scope*>): <subject*> (#<reference>)
--------------------------------------------------

<type*>
 build ...... Build system or external dependencies (Gulp, Broccoli, npm, ...)
 chore ...... Other changes that don't modify src or test files (.editorconfig, .gitignore, ...)
 ci ......... CI configuration files and scripts (Travis, Circle, BrowserStack, ...)
 conf ....... Configuration files (config/*.yaml, ...)
 docs ....... Documentation only changes (CHANGELOG, README, ...)
 feat ....... A new feature
 fix ........ A bug fix
 perf ....... A code change that improves performance
 refactor ... Refactoring or code-cleanup (no functional changes, no API changes)
 style ...... Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, ...)
 test ....... Adding missing tests or correcting existing tests

--------------------------------------------------
<type*> <<< |

4.6. GX commands

$ gx commands

  # GX commands :
    gx help ................ Display all help information about GX
    gx prompt .............. Display prompt information
    gx galiases ............ Display all Git aliases
    gx baliases ............ Display all Bash aliases
    gx commands ............ Display all GX commands
    gx install ............. Select and install GX elements
    gx reload .............. Reload GX
    gx status .............. Show status of GX elements
    gx config .............. Show GX git configuration
    gx remote-ref-branch ... Show remote reference branch (local & global)
    gx colors .............. Show all GX colors
    gx test [<func>] ....... Run one or all GX tests
    gx version ............. Show GX version
Note
More information on Git Xtended Documentation - GX commands

5. Comments, suggestions?

Feel free to make comments/suggestions to me in the Git issues section.

6. License

Git Xtended is released under the MIT License


About

This is Git Xtended, a shell tool that makes it easy to perform recurring actions with Git on a daily basis.

Topics

Resources

License

Stars

Watchers

Forks

Languages