{"id":13596063,"url":"https://github.com/keis/git-fixup","last_synced_at":"2025-05-16T07:00:26.573Z","repository":{"id":9050054,"uuid":"10815432","full_name":"keis/git-fixup","owner":"keis","description":"Fighting the copy-paste element of your rebase workflow.","archived":false,"fork":false,"pushed_at":"2025-01-07T12:40:58.000Z","size":119,"stargazers_count":255,"open_issues_count":8,"forks_count":18,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-12T03:10:29.937Z","etag":null,"topics":["fixup","git","rebase","squash","zsh"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"COPYING.md","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":"2013-06-20T08:24:03.000Z","updated_at":"2025-04-01T09:52:36.000Z","dependencies_parsed_at":"2022-08-07T05:00:26.964Z","dependency_job_id":"314abe23-3210-4f6c-abc8-c56468550c4b","html_url":"https://github.com/keis/git-fixup","commit_stats":{"total_commits":108,"total_committers":22,"mean_commits":4.909090909090909,"dds":0.6111111111111112,"last_synced_commit":"dc8c1657ca0b12885950150ab30cf4f5df693905"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keis%2Fgit-fixup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keis%2Fgit-fixup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keis%2Fgit-fixup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keis%2Fgit-fixup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keis","download_url":"https://codeload.github.com/keis/git-fixup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485025,"owners_count":22078764,"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":["fixup","git","rebase","squash","zsh"],"created_at":"2024-08-01T16:02:06.929Z","updated_at":"2025-05-16T07:00:26.538Z","avatar_url":"https://github.com/keis.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# git-fixup\n\nFighting the copy-paste element of your rebase workflow.\n\n`git fixup \u003cref\u003e` is simply an alias for `git commit --fixup \u003cref\u003e`. That's\njust a convenience feature that can be also be used to trigger tab completion.\n\nThe magic is in plain `git fixup` without any arguments.  It finds which\nlines/files you have changed, uses git blame/log to find the most recent commits\nthat touched those lines/files, and displays a list for you to pick from. This\nis a convenient alternative to manually searching through the commit log and\ncopy-pasting the commit hash.\n\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/484559/6431298/344ded94-c023-11e4-8b82-314387ceeee3.png\" alt=\"git fixup\" width=\"500px\" /\u003e\n\n## Install\n\nOn **OS X** you can install this script with _homebrew_\n\n    brew install git-fixup\n\nOn **Arch linux** you can install from AUR using _yaourt_ or a similar tool\n\n    yaourt git-fixup\n\nFor most other systems (as long as they include `install` and `make`) you can\ninstall by cloning this repo and running make\n\n    git clone https://github.com/keis/git-fixup.git\n    cd git-fixup\n    make install\n    make install-zsh\n\nOr if you don't want to deal with any of that you can simply download the\nscripts in anyway you like and make sure to put the program and completion\nscript into your `$PATH` and `$fpath` respectively.\n\n## Usage\n\n```\ngit-fixup [-s|--squash] [-f|--fixup] [-a|--amend] [-c|--commit] [--no-verify]\n          [--rebase] [-b|--base \u003crev\u003e] [-r|--reverse] [\u003cref\u003e]\n```\n\nFor this tool to make any sense you should enable the `rebase.autosquash`\nsetting in the git config, or use the `--rebase` option.\n\n\n```bash\n# Select the changes that should be part of the fixup.\n$ git add -p\n\n# Output a list of commits that the staged changes are likely a fixup of.\n$ git fixup\n\n# Create a fixup!-\u003ccommit\u003e of the given ref. If you have installed the zsh script\n# you can cycle through the list of fixup candidates with tab completion.\n$ git fixup \u003cref\u003e\n\n# Commit rebased into the selected commit as a fixup.\n$ git rebase -i ...\n```\n\n## Options\n\n### -s, --squash\n\nInstruct `git-fixup` to create a `squash!` commit instead of a `fixup!` commit.\n\nSquashing gives you the opportunity to edit the commit message before\nthe commits are squashed together.\n\nDefault action can be configured by setting [fixup.action](#fixupaction)\n\n### -f, --fixup\n\nInstruct `git-fixup` to create `fixup!` commit (This is the default).\n\nDefault action can be configured by setting [fixup.action](#fixupaction)\n\n### -a, --amend\n\nInstruct `git-fixup` to create an `amend!` commit.\n\nDefault action can be configured by setting [fixup.action](#fixupaction)\n\n### -c, --commit\n\nInstead of listing the suggested commits show a menu to pick a commit to\ncreate a fixup/squash commit of.\n\nA [default menu](#the-default-menu) is provided that is intentionally very\nsimple and with no advanced features. Instead of using it you can tell `git\nfixup` to use an external tool for the menu by defining a command line via\neither the [fixup.menu](#fixupmenu) setting in the git config or the `GITFIXUPMENU`\nenvironment variable (the latter overrides the former).\n\n```bash\n# Use fzf as a menu program\n$ GITFIXUPMENU=fzf git fixup -c\n```\n\nThis option can be enabled by default by setting [fixup.commit](#fixupcommit)\nin the git config.\n\n### --no-commit\n\nDon't show the commit menu even if previously instructed to do so.\n\n### --rebase\n\nCall an interactive rebase right after the commit is created, to automatically apply the\nfix-up into the target commit. This is merely to avoid doing two commands one after the\nother (`git fixup \u0026\u0026 git rebase`).\n\nThis simply calls `git rebase --interactive --autosquash target~1`, with the target being the\ncommit to fix-up.\n\nDefault rebase/no-rebase can be configured by setting [fixup.rebase](#fixuprebase)\n\n### --no-rebase\n\nDon't do a rebase even if previously instructed to do so (useful to bypass [fixup.rebase](#fixuprebase))\n\n### --no-verify\n\nBypass the pre-commit and commit-msg hooks. (see `git help commit`)\n\n\n### --base \u003crev\u003e\n\nThis option receives as argument the revision to be used as base commit for\nthe search of fixup/squash candidates. You can use anything that resolves to a\ncommit. The special value `closest` resolves to the closest ancestor branch of\nthe current head.\n\nIf omitted, the default base commit is resolved in the following order:\n\n1. The value of the environment variable `GITFIXUPBASE` if present;\n2. The value of the configuration key `fixup.base` if present;\n3. The branch configured as upstream of the current one (i.e. `@{upstream}`)\n   if existing;\n4. Finally, the root commit (i.e. full history) if nothing of the above is\n   satisfied.\n\n### --reverse\n\nCommits are sorted by time. `-r` reverses the sort order.\n\n## Configuration\n\n`git-fixup` uses configuration from the ENVIRONMENT or from `git config`\n\n### fixup.base\n\nOr `GITFIXUPBASE`\n\nThe default argument for `--base`. You can set the value `closest` to make\n`git-fixup` use the closest ancestor branch by default, for example.\n\n### fixup.action\n\nOr `GITFIXUPACTION`\n\nDecides if the default actions will be `fixup` or `squash`.\n\n### fixup.commit\n\nOr `GITFIXUPCOMMIT`\n\nDecides if the commit menu should be displayed instead of the commit list by\ndefault.\n\n```bash\n# Enable --commit for all my projects\n$ git config --global fixup.commit true\n```\n\n### fixup.rebase\n\nOr `GITFIXUPREBASE`\n\nDecides if `git rebase` should be called right after the `git commit` call.\n\n```bash\n# Enable --rebase for all my projects\n$ git config --global fixup.rebase true\n```\n\n### fixup.menu\n\nOr `GITFIXUPMENU`\n\nSets the command that will be used to display the commit menu. If not set\na simple [default menu](the-default-menu) will be used.\n\nSee [External menu](#external-menu) for more details and a more advanced\nexample.\n\n### fixup.additionalSortFlags\n\nOr `GITFIXUPADDITIONALSORTFLAGS`\n\nSets the flags that are passed to sort in addition to the default sort flags\nthat enable sorting by time.\n\nFor example,\n\n```bash\n# Always sort the commits by time reversed\n$ git config --global fixup.additionalSortFlags '-r'\n```\n\n## Tab completion\n\nTab completion for zsh/fish is implemented. The suggestions for the tab completion\nare the suggested fixup bases as generated by running the tool without any\narguments.\n\nTo be able to tab complete the command itself add a line like this to your zsh\nconfiguration::\n\n    zstyle ':completion:*:*:git:*' user-commands fixup:'Create a fixup commit'\n\n\n## External menu\n\nIn order to use an external tool for display the commit menu, you need to\neither define the [fixup.menu](#fixupmenu) setting in the git config or set the\n`GITFIXUPMENU` environment variable with the command for the menu. The menu\ncommand must receive as input the lines as the options for the user and return\nthe selected line to the standard output.\n\nThe following example is a fragment of a git config that makes `git fixup\n--commit` display a nice menu with [fzf](https://github.com/junegunn/fzf):\n\n```ini\n[fixup]\n    menu = fzf --height '60%' \\\n                --bind 'tab:toggle-preview' \\\n                --preview 'git show --color {+1}' \\\n                --preview-window=up:80% \\\n                --prompt 'Select commit: '\n```\n\n## The default menu\n\nIf you have not configured an external menu, the default menu is used. See the\nexample below:\n\n```bash\n$ git fixup -c\n1) 500be603c66040dd8a9ca18832d6221c00e96184 [F] Add README.md \u003cfoo@bar.com\u003e\n2) ddab3b03da529af5303531a3d4127e3663063e08 [F] Add index.js \u003cfoo@bar.com\u003e\nWhich commit should I fixup? \u003cyour-selection\u003e\n```\n\nHere `\u003cyour-selection\u003e` should be the number of the desired commit in the list.\nYou can use `q` to abort the operation and `h` to see a help message for the\nmenu.\n\nIf the commit title alone is not enough for you to decide, you can use `show\n\u003cnumber\u003e` to call `git show` on the `\u003cnumber\u003e`-th commit of the menu.\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md)\n\n## Authors\n\nThe fine people who have contributed to this script in ASCIIbetical order.\n\n- Cristiano Giuffrida ([cgiuffr](https://github.com/cgiuffr))\n- David Keijser ([keis](https://github.com/keis))\n- Elan Ruusamäe ([glensc](https://github.com/glensc))\n- Federico del Mazo ([FdelMazo](https://github.com/FdelMazo))\n- Gustavo Sousa ([guludo](https://github.com/guludo))\n- Joe Shaw ([joeshaw](https://github.com/joeshaw))\n- Martin Imre ([mimre25](https://github.com/mimre25))\n- Matěj Cepl ([mcepl](https://github.com/mcepl))\n- Philippe ([pe](https://github.com/pe))\n- Rickard Dybeck ([alde](https://github.com/alde))\n- Tiago Ribeiro ([fixe](https://github.com/fixe))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeis%2Fgit-fixup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeis%2Fgit-fixup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeis%2Fgit-fixup/lists"}