{"id":13681705,"url":"https://github.com/kowainik/hit-on","last_synced_at":"2025-06-11T18:03:51.913Z","repository":{"id":34300379,"uuid":"169189339","full_name":"kowainik/hit-on","owner":"kowainik","description":":octocat: Kowainik Git Workflow Helper Tool","archived":false,"fork":false,"pushed_at":"2023-01-13T22:00:53.000Z","size":283,"stargazers_count":77,"open_issues_count":17,"forks_count":13,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-04T19:36:18.399Z","etag":null,"topics":["cli-tool","git","github","github-api","haskell","kowainik-git-workflow","workflow"],"latest_commit_sha":null,"homepage":"https://kowainik.github.io/projects/hit-on","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kowainik.png","metadata":{"funding":{"ko_fi":"kowainik","github":["vrom911"]},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2019-02-05T04:15:03.000Z","updated_at":"2024-10-20T16:01:26.000Z","dependencies_parsed_at":"2023-01-15T06:05:40.794Z","dependency_job_id":null,"html_url":"https://github.com/kowainik/hit-on","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/kowainik/hit-on","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kowainik%2Fhit-on","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kowainik%2Fhit-on/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kowainik%2Fhit-on/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kowainik%2Fhit-on/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kowainik","download_url":"https://codeload.github.com/kowainik/hit-on/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kowainik%2Fhit-on/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259311622,"owners_count":22838757,"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":["cli-tool","git","github","github-api","haskell","kowainik-git-workflow","workflow"],"created_at":"2024-08-02T13:01:34.660Z","updated_at":"2025-06-11T18:03:51.888Z","avatar_url":"https://github.com/kowainik.png","language":"Haskell","funding_links":["https://ko-fi.com/kowainik","https://github.com/sponsors/vrom911"],"categories":["Haskell"],"sub_categories":[],"readme":"# Hit On\n\n![hit-on logo](https://user-images.githubusercontent.com/4276606/53816638-d86e4a00-3f9e-11e9-83ab-74032363292f.png)\n\n[![GitHub CI](https://github.com/kowainik/hit-on/workflows/CI/badge.svg)](https://github.com/kowainik/hit-on/actions)\n\n[![Hackage](https://img.shields.io/hackage/v/hit-on.svg?logo=haskell)](https://hackage.haskell.org/package/hit-on)\n[![Stackage Lts](http://stackage.org/package/hit-on/badge/lts)](http://stackage.org/lts/package/hit-on)\n[![Stackage Nightly](http://stackage.org/package/hit-on/badge/nightly)](http://stackage.org/nightly/package/hit-on)\n\n[![MPL-2.0 license](https://img.shields.io/badge/license-MPL--2.0-blue.svg)](LICENSE)\n\n**Kowainik Git Workflow Helper Tool.**\n\nYou can find the description of the workflow here:\n\n* [Kowainik Git Workflow](https://github.com/kowainik/org#workflow)\n\n`hit-on`  provides the `hit` binary with a convenient command-line interface to improve the interaction with [`git`][git] in a compatible way with the described working methods. It saves time for people who use this workflow on a daily basis, helps beginners expand their insight of the core VCS processes and makes collaboration between team members easier during development.\n\nHere is an example of how you can see the list of issues and the issue description with `hit`:\n\n![hit issue](https://user-images.githubusercontent.com/8126674/54478225-cae07c00-484a-11e9-86b3-c4c54e281274.png)\n\nOr how you can see pretty short stats about your changes:\n\n![hit status example](https://user-images.githubusercontent.com/4276606/60981099-428d6600-a368-11e9-97aa-656a3dd38efa.png)\n\n## Getting started\n\n### Prerequisites\n\nTo start using `hit` make sure that you have the following tools installed on your machine:\n\n+ [ `git`][git] — `hit` is a wrapper around `git`\n* [`hub`](https://github.com/github/hub) – to make PRs to GitHub directly.\n+ **Optional:** `diff-highlight` — for pretty output of the `hit diff` command\n  + Linux installation instructions\n    ```shell\n    cd /usr/share/doc/git/contrib/diff-highlight/\n    sudo make\n    sudo chmod +x diff-highlight\n    sudo ln -s diff-highlight /usr/local/bin/diff-highlight\n    ```\n  + [macOS installation instructions](https://www.viget.com/articles/dress-up-your-git-diffs-with-word-level-highlights/)\n\n### Installation\n\nThere are several methods to install the `hit` tool. You can choose the one that you are most comfortable with.\n\n#### Download from releases\n\nYou can download the `hit` binary directly from the GitHub releases:\n\n* [`hit` releases](https://github.com/kowainik/hit-on/releases)\n\nAfter downloading, make it executable and copy it to a convenient location, for example:\n\n```shell\nchmod +x hit-linux\nmv hit-linux ~/.local/bin/hit\n```\n\n#### Build from source\n\n\u003e **NOTE:** the project is written in Haskell, so you need to have one of the Haskell build tools installed. See this [blog post](https://kowainik.github.io/posts/2018-06-21-haskell-build-tools) for installation and usage instructions.\n\nYou need to follow these steps:\n\n1. Clone the repository from GitHub\n\n    ```shell\n    git clone https://github.com/kowainik/hit-on.git\n    ```\n2. Step into the directory\n\n    ```shell\n    cd hit-on\n    ```\n\n3. Install the project with one of the build tools\n  * [Cabal](https://www.haskell.org/cabal/users-guide/)\n     ```shell\n        cabal new-install hit-on\n     ```\n    **Note:** make sure you have `~/.cabal/bin` in your $PATH\n  * [Stack](https://docs.haskellstack.org/en/stable/README/)\n     ```shell\n        stack install hit-on\n     ```\n\n4. Make sure that `hit` is installed:\n\n    ```shell\n    hit --version\n    ```\n\n#### macOS package manager\n\nCurrently, this method of installation is not supported. See [this issue](https://github.com/kowainik/hit-on/issues/41) for more details or if you want to help.\n\n#### Ubuntu package manager\n\nCurrently, this method of installation is not supported. See [this issue](https://github.com/kowainik/hit-on/issues/42) for more details or if you want to help.\n\n### Setting up\n\nFollow the steps below to configure `hit` :\n\n1. Enable autocompletion by calling the following command:\n    ```shell\n    source \u003c(hit --bash-completion-script `which hit`)\n    ```\n    Add it your personal config file (like `~/.bashrc`) to enable automatically.\n2. Specify your GitHub login in the global `.gitconfig`\n```shell\ngit config --global user.login \u003cyour_login\u003e\n```\n3. **This step is only required if you want to use `hit` with private repositories**.\n    1. [Create OAuth token on GitHub.](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) The following scopes for the token should be specified:\n    ![Screenshot from 2019-03-16 22-34-57](https://user-images.githubusercontent.com/4276606/54476778-30793c00-483c-11e9-9625-a4f6ced40820.png)\n\n    2. Copy the generated token.\n    3. Export token as an environment variable\n        ```shell\n        export GITHUB_TOKEN=\u003cpaste_generated_token_here\u003e\n        ```\n\n## Commands\n\n | Command  | Description                                                                |\n |----------|----------------------------------------------------------------------------|\n | hop      | Switch to branch and sync it                                               |\n | fresh    | Rebase current branch on remote one                                        |\n | new      | Create new branch from the current one                                     |\n | stash    | Stash all local changes                                                    |\n | unstash  | Unstash previously stashed changes                                         |\n | commit   | Commit all local changes and prepend issue number                          |\n | uncommit | Reset to the previous commit saving the changes                            |\n | fix      | Fix requested changes to the last commit                                   |\n | amend    | Amend changes to the last commit and force push                            |\n | issue    | Show the information about the issue                                       |\n | push     | Push the current branch                                                    |\n | sync     | Sync local branch with its remote                                          |\n | resolve  | Switch to the main branch, sync and delete the branch                               |\n | clear    | Remove all local changes permanently                                       |\n | current  | Show info about current branch and issue (if applicable)                   |\n | status   | Show current branch and beautiful stats with COMMIT_HASH (by default HEAD) |\n | diff     | Display beautiful diff with COMMIT_HASH (by default HEAD)                  |\n | clone    | Clone the repo. Use 'reponame' or 'username/reponame' formats              |\n | log      | Outputs the log of the current commit or COMMIT_HASH                       |\n | tag      | Create or delete the specified tag TAG_NAME                                |\n\n## Usage\n\nThe best way to demonstrate the power of the `hit` tool on a day-to-day basis with our workflow is to go through the entire workflow step by step, solving an ordinary problem of the typical [`git`][git] user.\n\n\u003e Here we assume that you work with `origin` remote.\n\n### hit clone\n\nIf you don't have the repository locally, you need to clone it. With the `git`\ntool you would need to specify the full URL which you can get from the\nrepository GitHub page.\n\n```shell\ngit clone git@github.com:username/project-name.git\n```\n\n`hit` can simplify this process a bit. If you want to clone the project which is\nunder your GitHub username you can write:\n\n```shell\nhit clone my-project\n```\n\nIf this is not your personal repository then you can use `clone` command in the\nfollowing way:\n\n```shell\nhit clone owner-name/project-name\n```\n\n### hit hop\n\nWhen you want to start working on a new issue, you usually want to make sure you're using the latest version of your project. As a `git` user you may use the following commands:\n\n```shell\ngit checkout main\ngit pull --rebase --prune\n```\n\nWith `hit` you can just:\n\n```shell\nhit hop\n```\n\n### hit issue\n\nNow you need to decide which issue you want to work on. You can use the `hit issue` command to see the full list of all open issues. After choosing the number of the issue, let's say 42, call `hit issue 42` to see the details of that issue.\n\n### hit new\n\nStart your work in a new branch. According to our workflow, branch names should have the following form:\n\n```\n\u003cuser_login\u003e/\u003cissue_number\u003e-\u003cshort_issue_description\u003e\n```\n\nWith `git` you can create a branch using the following command:\n\n```shell\ngit checkout -b my-login/42-short-desc\n```\n\n`hit` allows you to accomplish this task in an easier manner:\n\n```shell\nhit new 42\n```\n\nIt uses the issue title to generate a short description.\n\n### hit status\n\nBefore commiting your changes, you may want to inspect short stats about your\nwork. With `git` you usually call the following command:\n\n```shell\ngit status\n```\n\nHowever, the same `hit` command produces better output:\n\n```shell\nhit status\n```\n\n![hit status example](https://user-images.githubusercontent.com/4276606/60981099-428d6600-a368-11e9-97aa-656a3dd38efa.png)\n\n### hit diff\n\nIf you want to see detailed diff of your changes, use `hit diff` command. If you\nhave `diff-hightlight` installed then `hit diff` outputs much nicer diffs.\n\n### hit commit\n\nAfter finishing your work on that issue, you need to commit your changes. With `git` you would do the following:\n\n```shell\ngit add .\ngit commit -m \"[#42] Implement my feature\n\nResolves #42\"\n```\n\nWith `hit` you need only to specify the text of the commit to get the same result:\n\n```shell\nhit commit \"Implement my feature\"\n```\n\nor even simplier:\n\n```shell\nhit commit\n```\n\nAnd the commit name would be the title of the corresponding issue at GitHub (if\nyou are currently in the branch named as described above).\n\nNote that you don't need to keep in mind the current issue number. However, if you want to refresh the context about the issue, use the `hit current` command.\n\n### hit push\n\nAfter committing your changes locally, you need to push them to the remote repository. It's usually a good practice to push only the current branch.\n\nThe `git` command for this is a little bit verbose:\n\n```shell\ngit push -u origin my-login/42-short-desc\n```\n\n`hit` allows you to save several keystrokes:\n\n```shell\nhit push\n```\n\n\u003e __Note:__ `hit push` command can be combined with the `hit commit` command\n\u003e using `-p|push` flag in the latter command.\n\u003e ```shell\n\u003e hit commit --push\n\u003e ```\n\n### hit sync\n\nAfter opening the pull request, some of the reviewers suggested changes that you applied as commits to the remote branch via GitHub interface. Now you need to sync your local branch with the remote one.\n\nWith `git` you can do the following:\n\n```shell\ngit pull --rebase origin my-login/42-short-desc\n```\n\nHowever, with `hit` you can just:\n\n```shell\nhit sync\n```\n\n### hit fresh\n\nWhile you were waiting for the second round of reviews, another pull request was merged to the `main` branch. Now you need to apply the new `main` changes to your local branch.\n\nWith `git` you can do the following:\n\n```shell\ngit fetch origin main\ngit rebase origin/main\n```\n\nAgain, with `hit` you can do better:\n\n```shell\nhit fresh\n```\n\n### hit fix\n\nNow you need to make changes to your work locally according to the code review and push them to the remote repository.\n\n`git` requires from you to do several steps to accomplish this simple task:\n\n```shell\ngit add .\ngit commit -m \"Fix after review\"\ngit push origin my-login/42-short-desc\n```\n\n`hit` helps you with this as well:\n\n```shell\nhit fix\n```\n\n### hit amend\n\nOops, you've just realised that you have made a typo in your work! So you fixed the typo. But now you want to update the remote branch without creating a new unnecessary commit.\n\nWith `git` you can do the following:\n\n```shell\ngit commit -a --amend --no-edit\ngit push origin my-login/42-short-desc --force\n```\n\nWith `hit` you can simply:\n\n```shell\nhit amend\n```\n\n### hit resolve\n\nHooray, your PR just got merged! It's time to clean your local repository and start working on a new issue!\n\nWith `git` you would do the following:\n\n```shell\ngit checkout main\ngit pull --rebase --prune\ngit branch -D my-login/42-short-desc\n```\n\nWith `hit` you can finish your work faster:\n\n```shell\nhit resolve\n```\n\n### hit log\n\nHooray, your PR just got merged! It's time to clean your local repository and start working on a new issue!\n\nWith `git` you would do the following:\n\n```shell\ngit log --oneline --decorate [COMMIT_HASH]\n```\n\nWith `hit` you can finish your work faster:\n\n```shell\nhit log [COMMIT_HASH]\n```\n\n[git]: https://git-scm.com/\n\n## Troubleshooting\n\nIf you see\n\n```shell\n$ hit hop\nfatal: ambiguous argument 'origin/HEAD': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git \u003ccommand\u003e [\u003crevision\u003e...] -- [\u003cfile\u003e...]'\nhit: readCreateProcess: git \"rev-parse\" \"--abbrev-ref\" \"origin/HEAD\" (exit 128): failed\n  origin/master\n...skipping...\n```\n\nthen you can run\n```shell\n$ git remote set-head origin -a\n```\n\nto synchronise with the remote, fetch and set `origin/HEAD` locally.\n\n## Acknowledgement\n\nIcons made by [Freepik](http://www.freepik.com) from\n[www.flaticon.com](https://www.flaticon.com/) is licensed by\n[CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkowainik%2Fhit-on","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkowainik%2Fhit-on","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkowainik%2Fhit-on/lists"}