{"id":21367278,"url":"https://github.com/robang74/git-functions","last_synced_at":"2026-02-20T18:31:03.534Z","repository":{"id":115207514,"uuid":"585550557","full_name":"robang74/git-functions","owner":"robang74","description":"A git shell based on bash to improve the git users experience. It offers many shortcuts to most frequently used git commands plus others for more sophisticated work like editing a commit.","archived":false,"fork":false,"pushed_at":"2026-01-19T21:21:32.000Z","size":250,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-20T02:28:33.805Z","etag":null,"topics":["bash","git"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robang74.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-01-05T13:09:40.000Z","updated_at":"2026-01-19T21:21:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"a538b95f-5a85-43b7-88f4-22e09e67a08c","html_url":"https://github.com/robang74/git-functions","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/robang74/git-functions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robang74%2Fgit-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robang74%2Fgit-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robang74%2Fgit-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robang74%2Fgit-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robang74","download_url":"https://codeload.github.com/robang74/git-functions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robang74%2Fgit-functions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29660019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T16:33:43.953Z","status":"ssl_error","status_checked_at":"2026-02-20T16:33:43.598Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","git"],"created_at":"2024-11-22T07:18:32.319Z","updated_at":"2026-02-20T18:31:03.504Z","avatar_url":"https://github.com/robang74.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-functions\n\nInstall `git-functions` to improve your git user experience with `gitshell`\n\n### UI changes\n\n\u003e [!WARNING]\n\u003e\n\u003e In `lg` and `lgnc` replaced `*` with `+` a more script friendly char\n\nChanges since `legacy` was published, when it was `main`branch\n\n* `lg` shows date\n* `lgfw`: added new\n* `merge`, `mtool`, `mclean`: added new\n* `pop`: do not show untracked file anymore\n* `rmtadd` improved with github support, opt:-G/-g added\n* `ff`, `sw`: in git use -w (ignore blank spaces) as default, opt:-r added\n* `ren`, `tagren`, `mgrp`, `amff`, `rmtadd`, `rmtdel`, `ch`: added new\n* `install.sh`: does not work within a `gitshell` sessione\n* `gfreload`: opt:-f added to reload a single function\n* `bcur`: opt:-c added to show current branch, only\n* `lsrmt`: was a short of `rmt` but now for `rmt -v`\n* `st`: opt:-m added to show `add -m` workbase\n* `amd`: opt:-m added to include modifications\n* `add`: opt:-a renamed in opt:-m\n\nIncomplete list (working in progress) of the changes since v0.4\n\n\u003c/br\u003e\n\n## Rationale\n\nEvery comfortable command-line UI should be verbose enough to be descriptive\nand self-explanatory and IMHO `git` achieved this goal very well. However, for\nintensive use - after having learned the command-line UI - verbosity impairs\nproductivity and there is no way to avoid writing `git` in front of every\ncommand unless a functions-set wrap layer is used. This is the point in which\n`git-functions` arrives and aims to help those whose hands wish to be faster\nthan their minds.\n\nHave fun \u003c3\n\n\n## About using bash\n\nThe `dash` which is the standard by default shell in GNU/Debian Linux is about\n2x faster than `bash` to execute commands and probably `bash` is the slowest\nshell of all. However, bashism are somewhat powerful shell-scripting tricks and\nmoreover, the user interaction with small functions does not require any\nparticular performance to be acceptable and in any case `git` is the real\nbottle-neck in performances especially when it queries a remote host.\n\n\n## Restricted shell\n\nAfter the `v0.4-rc1` the development went towards allowing the function to wrap\n`git` only into a restricted shell which is the bare minimum requirement to\noffer these shortcuts as a remote service. However, the limitations of the\nrestricted shell could be easily by-passed leveraging a PATH. In fact, usually\nbash is in the PATH so it can be executed in interactive mode `bash -i` without\nlimitations.\n\nThis shows clearly that `rbash` is not sufficient to restrict the user but also\nthe environment should be controlled and usually the easy way to achieve this\ngoal is to let the users play into a chroot-ed-environment specifically prepared\n\n\n## Give it a try\n\nJust to give it a try, source the `git.shell` in your environment and call them\nin your git local repository\n\n    GFRELOAD=1 source git.shell\n\nthis file also source the `colors.shell` in order to produce a color full output\nwhile functions will be loaded when `gitshell` will be lauched.\n\n\n## Installation\n\nTo install in your system in a way they will be loaded by `~/.bashrc` use this\nscript without any argument\n\n    git clone https://github.com/robang74/git-functions.git\n    cd git-functions\n    ./install.sh [ uninstall | update | reinstall | help ]\n\nthen follow the instructions, in particular source the `git.shell` in your\ncurrent bash environment. To install the development version switch the branch\nwith `git switch devel` and then run the installer from that branch.\n\nAlternatively, you can do a remote installation with these commands\n\n    branch=main\n    repo=https://raw.githubusercontent.com/robang74/git-functions\n    wget $repo/$branch/install.sh -O - | bash\n\nor\n\n    curl -sSL $repo/$branch/install.sh | bash\n\n\nYou might want to change the branch in `devel` but that branch, from time to\ntime, could be totally broken. Other branches might have the same problem.\nHowever, also for the `main` branch, it is not assured of the lack of bugs.\n\n\n## Usage\n\nAfter installation your `.bashrc` will be modified in such a way the `gitshell`\nwill be defined as a function. Calling it - in your git repository - will give\nyou the access to the wrap layer:\n\n    cd my-repo.git\n    gitshell\n    gfhelp\n\nThis command will display the functions available which are reported and\nbriefly described here below. If you need more functions, feel free to add to\nthe source code and share the change with the author. Or ask for an addition.\n\n\n## List of functions\n\nThe following list is divided for class of usage and roles. Only the main\nfunctions are loaded by `~/.bashrc` in the user bash environment while all the\nothers are available inside the `gitshell` environment.\n\n#### Main functions\n\n* `gitshell`: spawns a restricted shell with the git-funtcions environment\n* `gfupdate`: update the installation and reload the git-functions\n* `gfhelp`: like `gflist` but in a fancier way\n* `gflist`: list the functions available\n* `gfreloadafunc`: reload a single function\n* `gfreload`: reload the functions, opt:-f reload a single function\n\n#### Service functions\n\n* `cdtop`: change directory to the top level of the repository and prints the full path\n* `redef_git`: redefine the function `_git()` which is used internally\n* `reset_git`: reset `_git()` to the default command `git`\n* `noopts`: print every arg that does not start with minus\n\n* `ps1p`: print a custom PS1 for git users\n* `ps1s`: set the custom PS1 for git users\n\n* `egnc`: function alias for `egrep --color=never`\n* `less`: function alias for `command less -Fr`\n* `ugit`: unbuffered version of `git -P`\n* `ll`: short for 'ls -al' with colors\n* `eg`: short for 'egrep` with colors\n\nExample of `redef_git` and `reset_git` usage:\n\n    redef_git -u # every functions of this wrapper will use `ugit` instead of `git`\n    redef_git 'git -P \"$@\"'      # of this wrapper will use `git` with no pager\n    reset_git    # every functions of this wrapper will use `git` as default\n\n#### Configure functions\n\n* `pcache`: set the password cache for 1h of inactivity, deal with `.gitpasswd`\n* `editorset`: set your default editor\n\n#### Operative functions\n\n* `opst`: shows the current operation pending: merge, rebase or cherry-pick\n* `todo`: short for `git --edit-todo`, arg: c,m,r or current operation\n* `cont`: short for `git --continue`, arg: c,m,r,ce or current operation\n* `abrt`: short for `git --abort`, arg: c,m,r,ce or current operation\n* `skip`: short for `git --skip`, arg: c,m,r or current operation\n\n#### Functions which alter also the remote repository\n\n* `push`: short for `git pull`\n* `fpush`: short for `git push --force`\n* `repshrink`: clean the reflog and shrink the repository\n* `tagmv`: move a tag to hash (as args) and push the changes\n* `tagadd`: add a tag to a commit (sha as arg) and push tags\n* `tagdel`: del a tag (as arg) and push the change\n* `tagren`: rename a tag and push the change\n* `rmtadd`: add \u0026 fetch a remote repository, opt:-G/-g for github\n* `rmtdel`: delete a remote repository\n* `rmt`: short for `git remote`\n\n#### Functions which alter the local repository, only\n\n* `forig`: short for `git fetch origin`\n* `frmt`: short for `git fetch`, default the first in `rmt` or args with opt -a:--all\n* `search`: search for a string in all the commits and report the first found, arg string\n* `irb`, `irebase`: rebase starting from the hash passed or ~n/-n for `HEAD~n`\n* `amd`, amend`: shorts for `git amend` but with opt:-a does `add -m`\n* `add`: short for `git add` but opt:-m add all the modified items\n* `pa`: git-formatted patch apply and create signed commit\n* `ce`: commit edit within a restricted shell\n* `cr`: commit reword, a single SHA as arg\n* `ren`: short for `git mv`\n* `cm`: short for `git commit --signoff`\n* `co`: short for `git checkout`\n* `pull`: short for `git pull`\n* `rpull`: short for `git pull --rebase`\n* `rcont`: short for `git rebase --continue`\n* `stash`: short for `git stash`\n* `pop`: short for `git stash pop -q; ch`\n* `chpk`: short for `git cherry-pick`\n* `rst`: short for `git reset`, opt -h:--hard\n* `res`: short for `git restore`, opt -s:--staged, -h:hres()\n* `hrst`: short for `git reset --hard`, opt -r:remote\n* `sres`: short for `git restore --staged`\n* `hres`: it performs sres() and then co()\n* `ampatch`: short for `git amend` a patch/set\n* `amff`: short for `git am --show-current-patch=diff`\n* `merge`: short for git merge\n* `mtool`: short for git mergetool\n* `mclean`: find and delete all files about merge collision\n\n#### Functions which do NOT alter the repositories\n\n* `hconv`: convert the hash reference into a standard 7-chars hash\n* `lg`: show the log in a compact and fancy way, SHAs or files as args, opt:-$n\n* `lgnc`: the same of `lg` but without colors, for scripting\n* `lgfw`: the same of `lgnc` but using `--follow` option for log\n* `lgrpnc`: the same of `lgrp` but without colors, for scriptings\n* `lt`: like `lg` but with all branches shown, files as args\n* `lg1`: like `lg` but just the first line, shortcut for `lg -1`\n* `rl`, `reflog`: shorts for `git reflog`\n* `sf`: show the file involved in a commit, SHAs as args\n* `st`: short for `git status`, opt:-m shows what `add -m` uses\n* `ch`: added new as short for status but without untracked\n* `sw`: short for `git show` with `sf` after, opt:-P for no pager\n* `ff`: short for `git diff -w`, opts -s:staged -o:origin -r:remote\n* `fpatch`: do a `git format-patch` for the commit, SHA and opts in arg\n* `bsw`: short for `git switch`, the branch name as arg or `-` for the last\n* `lgrp`: find a string into the `lg` output, opts -s:SHAs-only -1:first only\n* `lsbr`: show the list of branches, arg branch name, opt: -r:remotes, -a:all\n* `lsrmt`: short for `rmt -v`, it shows the verbose list of remotes sources\n* `mgrp`: search a `'string'` into `st -m` changed file or from hash, default `HEAD` or ~n/-n for `HEAD~n`\n* `rcur`: remote origin which the current branch is tracking, opt:-c --show-current only\n* `rbcur`: remote branch which the current brach is tracking\n* `hcur`: short for `git rev-parse --short HEAD`\n* `bcur`: short for `git branch --show-current`\n* `lstag`, `tagl`: shorts for `git tag -l`\n\n#### Command execution on multiple branches\n\nThis is a special function used to execute commands (cmds) on multiple branches:\n\n* `for-all-other-branches`: execute the args as commands for the branches\n  * `--`: per default runs over all the branches but not the current one\n  * `-a`: all the branches included the current\n  * `-p`: `git pull` before cmds\n  * `-r`: `git pull --rebase` before cmds\n  * `-n`: not fail despite the last command failure\n  * `-s`: `git stash` before go and `git stash pop` when returns\n  * `-f`: fetch all the remotes before starting otherwise run only on locals\n\nA custom branches selection could be specified in this way:\n\n    BRANCHES=\"uno due tre\" for-all-other-branches 'cmds ${branch}'\n\nThe `branch` variable is defined in the loop and its value is the branch name\non which commands are currently executing. The single quotes around the\ncommands string are necessary to avoid that the variable is expanded before\nstarting the loop.\n\nIn case the last command fails then the loop stops and spawns an emergency `bash`\nin that shell - which is restricted - the operator can handle the issue and\nthen decide to proceed further with `exit` or definitely stop with `exit 1`.\n\n    Switch to branch 'devel'\n    Your branch is up-to-date with 'origin/devel'.\n\n    branch: devel, KO\n    fix the problem and then enter 'exit'\n    or enter 'exit 1' to abort completely\n\n    +git:devel\u003e exit 1\n\n\n## Password cache\n\nThe use of the password cache function `pcache` could undermine your git remote\nrepository security especially if used in combination with `.gitpasswd`.\nMoreover the use of the password cache or saving your git password in plain\ntext in a file of your workstation disk could go against your company security\npolicies. For extra security you can disable this function with\n\n    unset pcache\n\nYou might also want to add after the source `git.function` in your `~/.bashrc`\nto make this choice as the default one. However, `gfreload` and `gfupdate` will\nload again into your current bash environment. To avoid this risk, then use:\n\n    unset pcache gfreload gfupdate\n\nSo, no one of these functions will be able to interfere with your security\npolicy but you will need to use `install.sh update` to update your\ngit-functions installation.\n\nThe alternative is to store the password in your home git global config or in\nthe current git local config and pcache will retrieve your password from there.\n\nThe first time that `pcache` runs, it would be better setting the git username:\n\n    pcache --user $git_my_user_name\n\nOtherwise the username will be asked by the cache manager but will be lost when\nthe cache will expire. Setting the user works on https remote repositories.\n\n\n## isatty() override\n\nTo improve dramatically the fancy coloured output combined with some features\nlike grepping and lessing, it has been used the trick to override `isatty()`\nusing a small piece of code `isatty_override.c` which produces `.so` library:\n\n    LD_PRELOAD=\"${path}/isatty_override.so\" git -P \"$@\"\n\nThis is an example of usage which resembles the core of the 'ugit' function.\n\n\u003c/br\u003e\n\n# License\n\nAlmost all the files are under one of many FOSS licenses and the others are in\nthe public domain. Instead, the composition of these files is protected by the\nGPLv3 license under the effects of the [Copyright Act, title 17. USC §101](\nhttps://www.law.cornell.edu/uscode/text/17/101):\n\n\u003e Under the Copyright Act, a compilation [EdN: \"composition\" is used here as\nsynonym because compilation might confuse the technical reader about code\ncompiling] is defined as a \"collection and assembling of preexisting materials\nor of data [EdN: data includes source code, as well] that are selected in such\na way that the resulting work as a whole constitutes an original work of\nauthorship.\"\n\nThis means, for example, that everyone can use a single MIT licensed file or a\npart of it under the MIT license terms. Instead, using two of them or two parts\nof them implies that you are using a subset of this collection which is a\nderived work of this collection which is licensed under the GPLv3, also.\n\nThe GPLv3 license applies to the composition unless you are the original author\nof a specific unmodified file. This means that every one that can legally claim\nrights about the original files maintains its rights, obviously. Therefore the\noriginal authors do not need to undergo the GPLv3 license applied to the\ncomposition and they maintains their original right in full. Unless, they use\nthe entire composition or a part of it for which they had not the rights, \nbefore.\n\nSome files, documents, software or firmware components can make an exception to\nthe above general approach due to their specific copyright and license\nrestrictions. In doubt, follow the thumb rule of fair-use.\n\nIn this project, the copyright notice, the license and the author is reported \nin each file header and here just listed:\n\n* `colors.shell`: MIT\n* `isatty_override.c`: MIT\n* `git-commit-edit`: public domain\n* `git-isar-send-patch`: GPLv3\n* `git.functions`: GPLv3\n* `cr-editor.sh`: GPLv3\n* `install.sh`: GPLv3\n* `git.shell`: GPLv3\n\nFor further information or requests about licensing and how to obtain a fork\nsuitable for your own business, please write to the project maintainer and \ncopyleft owner.\n\n## Author\n\n* Roberto A. Foglietta \u003croberto.foglietta@gmail.com\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobang74%2Fgit-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobang74%2Fgit-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobang74%2Fgit-functions/lists"}