{"id":21806827,"url":"https://github.com/roguh/gp","last_synced_at":"2026-04-02T02:50:43.166Z","repository":{"id":46292706,"uuid":"423044826","full_name":"roguh/gp","owner":"roguh","description":"Git pull, push, push new remote branch. Shellscript.","archived":false,"fork":false,"pushed_at":"2024-10-22T18:10:05.000Z","size":97,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T04:42:02.204Z","etag":null,"topics":["bash","dash","git-pull","git-push","gp","linux","macos","macosx","osx","posix","sh","unix","zsh"],"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/roguh.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":"2021-10-31T03:38:15.000Z","updated_at":"2025-01-21T15:00:01.000Z","dependencies_parsed_at":"2024-10-23T01:59:45.638Z","dependency_job_id":null,"html_url":"https://github.com/roguh/gp","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roguh%2Fgp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roguh%2Fgp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roguh%2Fgp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roguh%2Fgp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roguh","download_url":"https://codeload.github.com/roguh/gp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244759961,"owners_count":20505716,"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","dash","git-pull","git-push","gp","linux","macos","macosx","osx","posix","sh","unix","zsh"],"created_at":"2024-11-27T12:30:12.485Z","updated_at":"2025-12-30T20:53:25.003Z","avatar_url":"https://github.com/roguh.png","language":"Shell","readme":"# gp: Git pull, push, push new remote branch\n\n\u003c!--\nEDIT README.template.md, not README.md directly.\nUse `make build-readme to update the README file\n--\u003e\n\nLike the waves.\n\nOriginally written in 2021 as I realized I could make fish abbreviations or\nshell aliases for most git commands using two letters, e.g.\n\"gl\" for git log, but \"gp\" could feasibly be \"git pull\" or \"git push\"\nHenceforth, I wrote this tool to consolidate both actions into one short\ncommand to fit my pattern.\n\"gp\" is now either \"git push\" or \"git pull\" or a no-op, depending on your\ngit tree and the remote's statuses\n\n## Usage\n\n```\ngp --help\ngp: Pull, push, push new branch. Version 1.4.0\n\n- If there are changes in the remote branch, pull\n- If there are changes in the local branch, push\n- If there is no remote branch, prompt to push a new branch.\n  Skip prompt with gp -f\n- If the branches have diverged, do nothing.\n  Force push with gp -f\n\nUSAGE: gp [-f|-v|-h|--version]\n    -f|--force   Do not prompt for verification when pushing new branch.\n                 Force push when local and remote branches diverged.\n    -v|--verbose Show more output.\n    -h|--help    Show this message.\n    --version    Show program version.\n\n```\n\nTo pull, push, or push a new remote branch:\n\n```\ngp\n```\n\nAs above, but force push if diverged and do not prompt to push a new remote branch:\n\n```\ngp --force\ngp -f\n```\n\n## Installation\n\n### Option 1:\n\n1. Download [raw.githubusercontent.com/roguh/gp/main/gp](https://raw.githubusercontent.com/roguh/gp/main/gp).\n2. Make executable and move to your preferred binary location.\n\n```\nchmod +x gp\nsudo cp gp /usr/bin/gp\n```\n\n### Option 2:\n\n```\ngit clone https://github.com/roguh/gp.git\ncd gp\nmake install\n```\n\nOR\n\n```\ngit clone https://github.com/roguh/gp.git\ncd gp\nmake install-to-user\n```\n\n## Unit Testing\n\n### Linux: Running tests for many shells at once\n\n```\nmake unit-test-on-linux\n```\n\nTo include stricter POSIX shells:\n\n```\nmake unit-test-all-on-linux\n```\n\n### Bash: Running tests for many shells at once\n\n```\nmake unit-test-on-macos\n```\n\n## Integration Testing\n\nTesting is a semi-manual process.\nMake sure you have permission to push new branches to the remote repository.\n\nIf the test script fails, the tests have failed.\nAlso read the output to determine if `gp` is behaving correctly.\n\nNote the `test-integration-all-shells.sh` script runs the `test-integration.sh` script using the test shell itself.\n\n### Linux: Running tests for many shells at once\n\n```\nmake test-on-linux\n```\n\n### MacOS: Running tests for many shells at once\n\n```\nmake test-on-macos\n```\n\n### Running tests for stricter POSIX shells\n\n```\nmake test-on-strict-posix-shells\n```\n\n### Running tests one shell at a time\n\nRun the following commands:\n\n```\n./tests/test-integration.sh sh\n./tests/test-integration.sh dash\n./tests/test-integration.sh bash\nBASH_COMPAT=31 ./tests/test-integration.sh bash\n./tests/test-integration.sh zsh\n```\n\n### Test results\n\n### Linux\n\nTested using GNU coreutils 9.0 in these shells:\n\n- dash 0.5\n- bash 5.1\n- bash 5.1 in bash 3.1 compatibility mode BASH_COMPAT=31\n- zsh 5.8\n- yash 2.52\n- ksh version 2020.0.0\n\n### MacOS\n\nNot tested on MacOS, yet. It should work fine.\n\n## Linting and Compatibility Check\n\nUse shellcheck to check shellscripts.\n\n```\nmake check\n```\n\n## Why?\n\n- I wanted a convenient shortcut for `git pull` and `git push`.\n  I recently created git aliases (and fish abbreviations), e.g. `gl` for `git\n  log`, and I wanted to use `gp` for either `git pull` or `git push` depending\n  on the state of the repo. This needed more complex code so I wrote this script\n  and eventually moved it to its own repo.\n- To demonstrate how I would deploy code. Features:\n  - Linting and other automated checks.\n  - Thorough tests.\n    - Integration tests and a way to run them on many different platforms.\n    - Unit tests that run on many shells, even on Bash 2.03\n  - Good documentation.\n  - GitHub Actions for running tests and code checks.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froguh%2Fgp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froguh%2Fgp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froguh%2Fgp/lists"}