{"id":20743871,"url":"https://github.com/reiniiriarios/git-commands","last_synced_at":"2025-04-24T05:44:27.428Z","repository":{"id":111408348,"uuid":"522674350","full_name":"reiniiriarios/git-commands","owner":"reiniiriarios","description":"Commonly used aliases, functions, etc. ✌🏻","archived":false,"fork":false,"pushed_at":"2024-05-23T18:14:12.000Z","size":190,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-24T05:44:21.555Z","etag":null,"topics":["bash","bashrc","git","git-shortcuts","zsh","zshrc"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reiniiriarios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-08-08T19:06:14.000Z","updated_at":"2024-05-23T18:14:15.000Z","dependencies_parsed_at":"2024-04-08T21:34:00.528Z","dependency_job_id":"394e39d9-83b1-4a3e-8c45-8fe2329655c2","html_url":"https://github.com/reiniiriarios/git-commands","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reiniiriarios%2Fgit-commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reiniiriarios%2Fgit-commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reiniiriarios%2Fgit-commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reiniiriarios%2Fgit-commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reiniiriarios","download_url":"https://codeload.github.com/reiniiriarios/git-commands/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250573299,"owners_count":21452342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","bashrc","git","git-shortcuts","zsh","zshrc"],"created_at":"2024-11-17T07:13:21.221Z","updated_at":"2025-04-24T05:44:27.411Z","avatar_url":"https://github.com/reiniiriarios.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-commands\n\nCommonly used aliases, functions, etc. ✌🏻\n\n[→ Jump to `git-commands.sh` source](https://github.com/reiniiriarios/git-commands/blob/main/git-commands.sh)\n\n## Install\n\nClone repo and...\n\n```sh\n./install.sh\n```\n\n- adds symbolic link from `$HOME/.git-commands.sh` to `git-commands.sh`\n- adds `[ -s \"$HOME/.git-commands.sh\" ] \u0026\u0026 . \"$HOME/.git-commands.sh\"` to `.bashrc` or `.zshrc`\n- on macOS, installs [gnu-sed](https://formulae.brew.sh/formula/gnu-sed) if not found\n\n## Help\n\nThe `gcmd` command provides a help interface for these shortcuts. Most functions also have a `-h`\nflag available to display help.\n\nCommand|Description\n---|---\n`gcmd -f`|Display help for common functions.\n`gcmd -l`|Display help for helper functions.\n`gcmd -a`|Display help for aliases.\n`gcmd -h \u003calias_name\u003e`|Display help for an alias.\n`\u003cfunction_name\u003e -h`|Display help for a function.\n\n## Highlights\n\nAlias|Function|Description\n---|---|---\n-|`git_find_parent_branch [-a] [branch_name]`|find parent of current or specified branch with regex filtering; `-a` to find without regex filtering\n-|`git_find_branch \u003csearch_string\u003e`|useful for finding by issue id\n-|`git_commits_out_of_date [parent_branch] [branch_name]`|get number of commits current or specified branch is behind parent or specified parent\n-|`git_branch_has_remote \u003cbranch_name\u003e`|whether specified branch has remote (boolean)\n`gswf`|`git_switch_branch_by_search \u003csearch_string\u003e`|`switch` via search string, e.g. `gswf 1234` if branch name has issue number\n`grf`|`git_rebase_forward`|rebase current branch to be up to date with parent\n`grom`|`git_rebase_on_main`|rebase current branch to be up to date with main\n`grob`|`git_rebase_on_branch \u003csearch_string\u003e`|rebase current branch on branch found via `git_find_branch`\n`grbn`|`git_rebase_n_commits \u003cn\u003e`|`rebase -i HEAD~$1` _n_ commits\n`gsquash`|`git_squash \u003cn\u003e`|squash _n_ commits via `rebase -i`\n`grn`|`git_reset \u003cn\u003e`|`reset --soft HEAD~$1` _n_ commits and then `reset` to unstage\n`gbrebase`|`git_rebase_branch`|`rebase -i` all commits on the current branch\n`gbsquash`|`git_squash_branch`|squash all commits on current branch via `rebase -i`\n`gbreset`|`git_reset_branch`|soft reset all commits and unstage changes on current branch\n`gbdel`|`git_delete_branch_by_search`|delete branch by search string, e.g. `gswf 1234` if branch name has issue number\n`gremotereset`|`git_remote_reset`|reset branch to remote\n`gbcount`|`git_branch_num_commits`|display number of commits on current branch\n`gfp`|`git_force_push`|`push --force-with-lease` with branch protection\n`gmff`|`git_merge_ff`|`merge --ff-only` with some error checking\n`gmffthis`|`git_merge_ff_this`|checkout parent and then `merge --ff-only` current branch\n`gwip`|-|commit all currently tracked files with message \"WIP\"\n`gunwip`|-|reset and unstage last commit if message is \"WIP\"\n`gbdd`|`git_drop_drop_commits`|drop all commits in current branch with messages beginning with `drop: `\n`gmt \u003ctag\u003e`|`git_move_tag`|move tag to current commit both locally and on origin, pushing the current branch first\n`gtp \u003ctag\u003e`|`git_push_tag`|push the current branch, then push the tag to origin\n\n## Example Workflow Comparison\n\n```sh\ngit switch main\ngit pull\ngit switch ABC-123-jira-made-a-branch-name-just-for-me\ngit rebase main\n# Count commits in branch, or copy a commit revision\ngit rebase -i HEAD~10\n# Change `pick` to `drop` for any temporary commits, then\n# swap `pick` with `squash` on every commit after the first\n# Rewrite commit message\ngit push --force-with-lease\n# Wait for CI\ngit switch main\ngit merge --ff-only ABC-123-jira-made-a-branch-name-just-for-me\ngit push\n```\n\nvs\n\n```sh\ngswf 123\ngrom\ngbsquash\n# Rewrite commit message\ngfp\n# Wait for CI\ngmffthis\ngp\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freiniiriarios%2Fgit-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freiniiriarios%2Fgit-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freiniiriarios%2Fgit-commands/lists"}