{"id":21185823,"url":"https://github.com/erikjuhani/git-fixup","last_synced_at":"2026-02-28T17:32:26.997Z","repository":{"id":242467151,"uuid":"809256441","full_name":"erikjuhani/git-fixup","owner":"erikjuhani","description":"`git fixup` for better developer experience","archived":false,"fork":false,"pushed_at":"2024-08-24T20:11:23.000Z","size":3,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-11T17:06:24.853Z","etag":null,"topics":["commit","developer-experience","fixup","git","rebase"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erikjuhani.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}},"created_at":"2024-06-02T07:00:05.000Z","updated_at":"2025-05-20T23:04:45.000Z","dependencies_parsed_at":"2025-01-21T12:46:46.304Z","dependency_job_id":"df9afdd0-e684-42e0-b092-0df43a574898","html_url":"https://github.com/erikjuhani/git-fixup","commit_stats":null,"previous_names":["erikjuhani/git-fixup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/erikjuhani/git-fixup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikjuhani%2Fgit-fixup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikjuhani%2Fgit-fixup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikjuhani%2Fgit-fixup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikjuhani%2Fgit-fixup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erikjuhani","download_url":"https://codeload.github.com/erikjuhani/git-fixup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikjuhani%2Fgit-fixup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29944767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T13:49:17.081Z","status":"ssl_error","status_checked_at":"2026-02-28T13:48:50.396Z","response_time":90,"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":["commit","developer-experience","fixup","git","rebase"],"created_at":"2024-11-20T18:19:14.502Z","updated_at":"2026-02-28T17:32:26.973Z","avatar_url":"https://github.com/erikjuhani.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-fixup\n\nCreates a git fixup commit that is amended automatically to the target commit.\n\n'fzf' is used to improve the user experience by providing a selectable list of\nusable commits. If 'fzf' is not found in the PATH user must provide the commit\nhash to the 'git-fixup' command.\n\nThis command is intended to be used as a git alias. Aliases can be added to\n'.gitconfig' file. Add an alias to the '.gitconfig' file called 'fixup' (or\nsome other preferred name) and point it to the location of this script.\n\n```.gitconfig\n[alias]\n\tfixup = git-fixup\n```\n\n## Problem statement\n\nApplying changes to the last commit with git is trivial, but when applying\nchanges to older commits we need to run cumbersome commands to make the changes\nand to keep the git history pristine.\n\nI'm quite certain that many developers will face the issue of wanting to edit a\nprevious commit, especially when relying on rebase mechanics (as one should).\nHowever, fixups are a great way to keep the context of the commit knowledge\nwithin a single commit by directly modifying the existing commit and rebasing\nthe history.\n\nIf you are not familiar with rebasing, I highly recommend reading the following\nchapter from the Pro Git book [3.6 Git Branching -\nRebasing](https://git-scm.com/book/en/v2/Git-Branching-Rebasing).\n\nThe usual flow for applying fixups is as follows:\n\n```\n# Stage changes for older commit in the branch\ngit add file.txt\n\n# Find the commit hash by using the log command and copy the commit hash\ngit log --oneline origin..\n\n# Create a fixup\ngit commit --fixup \u003ccommit_hash\u003e\n\n# Interactive rebase with autosquash and autostash\ngit rebase -i --autosquash --autostash\n```\n\nAs we can see, the process itself is quite cumbersome and requires a better\napproach, especially since this is a recurring operation that happens multiple\ntimes a day.\n\n\n## Solution\n\nThe solution is simple:\n\nCreate a git alias called `fixup` that will run a POSIX-compatible shell\nscript, which automates the cumbersome parts of the fixup operation.\n\nThe same example as above, but with the fixup command:\n\n```\n# Stage changes for older commit in the branch\ngit add file.txt\n\n# Prompts fzf to select commit hash the fixup should be applied to.\n# After selection creates a fixup that is rebased to the original commit.\ngit fixup\n```\n\nAs we can see, the solution is vastly simpler than the original way of creating\nfixup commits.\n\nThe one caveat is the requirement of the external dependency fzf, but I'd\nimagine this is one of the 'default' tools developers have on their machines\nanyway.\n\n## Installation\n\nEasiest way to install `git-fixup` is with [shm](https://github.com/erikjuhani/shm).\n\nTo install `shm` run either one of these one-liners:\n\ncurl:\n\n```sh\ncurl -sSL https://raw.githubusercontent.com/erikjuhani/shm/main/shm.sh | sh\n```\n\nwget:\n\n```sh\nwget -qO- https://raw.githubusercontent.com/erikjuhani/shm/main/shm.sh | sh\n```\n\nthen run:\n\n```sh\nshm get erikjuhani/git-fixup\n```\n\nto get the latest version of `git-fixup`.\n\n`git-fixup` uses `fzf` which can be installed by following the instructions [here](https://github.com/junegunn/fzf#installation).\n\n## Usage\n\n```sh\ngit-fixup [\u003ccommit_hash\u003e]\n```\n\nWhen commit hash is not provided `git-fixup` will use 'fzf' to provide a list\nof selectable commits in the branch, however, if 'fzf' is not found in the\nPATH, user _must_ provide a commit hash.\n\n### Examples\n\n#### Amend to older commit behind 2 commits in the current branch\n\n```sh\ngit add file.txt\ngit-fixup HEAD~2\n```\n\n#### Amend to older commit in the current branch using git alias\n\n```sh\ngit add file.txt\ngit fixup HEAD~2\n```\n\n#### Amend to selected commit with 'fzf'\n\n```sh\ngit add file.txt\ngit-fixup\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikjuhani%2Fgit-fixup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferikjuhani%2Fgit-fixup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikjuhani%2Fgit-fixup/lists"}