{"id":13459677,"url":"https://github.com/lifeparticle/Git-Cheatsheet","last_synced_at":"2025-03-24T18:31:06.344Z","repository":{"id":56817253,"uuid":"228263428","full_name":"lifeparticle/Git-Cheatsheet","owner":"lifeparticle","description":"Git Helper","archived":false,"fork":false,"pushed_at":"2024-06-06T09:28:45.000Z","size":37,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-01T10:19:19.687Z","etag":null,"topics":["cheatsheet","git","github","source-control"],"latest_commit_sha":null,"homepage":"","language":null,"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/lifeparticle.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},"funding":{"github":["lifeparticle"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2019-12-15T22:42:02.000Z","updated_at":"2024-07-07T16:42:13.000Z","dependencies_parsed_at":"2024-02-09T14:29:36.773Z","dependency_job_id":"e9a79628-acef-4313-be03-523dad6568a8","html_url":"https://github.com/lifeparticle/Git-Cheatsheet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeparticle%2FGit-Cheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeparticle%2FGit-Cheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeparticle%2FGit-Cheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeparticle%2FGit-Cheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lifeparticle","download_url":"https://codeload.github.com/lifeparticle/Git-Cheatsheet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221995746,"owners_count":16913553,"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":["cheatsheet","git","github","source-control"],"created_at":"2024-07-31T10:00:24.680Z","updated_at":"2025-03-24T18:31:06.338Z","avatar_url":"https://github.com/lifeparticle.png","language":null,"readme":"1. Revert the main branch to a previous commit\n\n2. Create and switch to a new branch\n\n```shell\ngit switch -c path_config\n# Switched to a new branch 'path_config'\n```\n\n3. List all local branches\n\n```shell\ngit branch --all\n```\n\n4. List all the remote brances\n\n```shell\ngit branch -r\n```\n\n5. Reset all changes after last commit\n\nUndo chnages to tracked file:\n\n```shell\ngit reset HEAD --hard\n```\n\n6. Remove GIT History (Caution it delete all the commit history)\n\n```shell\ngit checkout --orphan last\ngit add -A\ngit commit -am \"fresh init\"\ngit branch -D main\ngit branch -m main\ngit push -f origin main\n```\n\n7. Bare repository\n\n```shell\ngit clone --mirror git@github.com:lifeparticle/binarytree.git\n```\n\n8. Log\n\n```shell\ngit log --oneline\n```\n\n9. Git bisect\n\n```shell\ngit bisect start\ngit bisect bad\ngit bisect good\n```\n\n10. Reduce Git repository size\n\n```shell\ngit clone --mirror git@github.com:lifeparticle/binarytree.git\nbfg --strip-blobs-bigger-than 1M binarytree.git\ncd binarytree.git\n```\n","funding_links":["https://github.com/sponsors/lifeparticle"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifeparticle%2FGit-Cheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifeparticle%2FGit-Cheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifeparticle%2FGit-Cheatsheet/lists"}