{"id":19858474,"url":"https://github.com/martin-cotta/git","last_synced_at":"2026-06-16T14:31:23.259Z","repository":{"id":151577794,"uuid":"153001220","full_name":"martin-cotta/git","owner":"martin-cotta","description":"Tips and things always forget about git","archived":false,"fork":false,"pushed_at":"2018-10-14T18:30:42.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-23T15:20:26.450Z","etag":null,"topics":["git"],"latest_commit_sha":null,"homepage":null,"language":null,"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/martin-cotta.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":"2018-10-14T17:40:02.000Z","updated_at":"2018-10-14T18:30:49.000Z","dependencies_parsed_at":"2023-05-20T22:45:46.425Z","dependency_job_id":null,"html_url":"https://github.com/martin-cotta/git","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/martin-cotta/git","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martin-cotta%2Fgit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martin-cotta%2Fgit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martin-cotta%2Fgit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martin-cotta%2Fgit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martin-cotta","download_url":"https://codeload.github.com/martin-cotta/git/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martin-cotta%2Fgit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34410778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["git"],"created_at":"2024-11-12T14:23:39.121Z","updated_at":"2026-06-16T14:31:23.239Z","avatar_url":"https://github.com/martin-cotta.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tips and things always forget about git\n\n## Delete branches\n\n```sh\n# Delete local branch\n$ git branch -delete feature/name # or\n$ git branch -d feature/name\n\n# Delete local branch (regardless of its push and merge status)\n$ git branch --delete --force feature/name # or\n$ git branch -D feature/name\n\n# Delete remote branch (or tag)\n$ git push origin --delete feature/name # or\n$ git push origin :feature/name\n```\n\n## Update author info\n\n```sh\n# bare clone the repo\n$ git clone --bare https://github.com/user/repo.git\n$ cd repo.git\n\n# rewrite author info (update OLD_EMAIL, CORRECT_NAME \u0026 CORRECT_EMAIL before run it)\n$ git filter-branch --env-filter '\nOLD_EMAIL=\"your-old-email@example.com\"\nCORRECT_NAME=\"Your Correct Name\"\nCORRECT_EMAIL=\"your-correct-email@example.com\"\nif [ \"$GIT_COMMITTER_EMAIL\" = \"$OLD_EMAIL\" ]\nthen\n    export GIT_COMMITTER_NAME=\"$CORRECT_NAME\"\n    export GIT_COMMITTER_EMAIL=\"$CORRECT_EMAIL\"\nfi\nif [ \"$GIT_AUTHOR_EMAIL\" = \"$OLD_EMAIL\" ]\nthen\n    export GIT_AUTHOR_NAME=\"$CORRECT_NAME\"\n    export GIT_AUTHOR_EMAIL=\"$CORRECT_EMAIL\"\nfi\n' --tag-name-filter cat -- --branches --tags\n\n# Push the corrected history to remote\n$ git push --force --tags origin 'refs/heads/*'\n```\n\n## Manually merge a GitHub PR\n\nCreate a PR in GitHub to merge branch `release\\1.0.0` back to `master`\n\n```sh\ngit checkout release/1.0.0\ngit pull\ngit submodule update --init\n\ngit checkout master\ngit pull\n\ngit merge --no-ff release/1.0.0\ngit push origin master\n```\n\n## Amending the last commit\n\nTo change the last commit, you can simply commit again, using the `--amend` flag:\n\n```sh\ngit commit --amend -m \"New and correct message\"\n```\n\n## Undo the last commit(s)\n\n```sh\n# Just move HEAD one commit down (keep changes)\ngit reset --soft HEAD~1\n# Reset the index and working tree (don't keep changes)\ngit reset --hard HEAD~1\n```\n\n## Delete a tag\n\n```sh\n# delete local tag\ngit tag -d tagname\n\n# delete remote tag\ngit push origin :refs/tags/tagname\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartin-cotta%2Fgit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartin-cotta%2Fgit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartin-cotta%2Fgit/lists"}