{"id":16209982,"url":"https://github.com/gann4life/git-cheat-sheet","last_synced_at":"2026-06-15T20:31:21.417Z","repository":{"id":119348666,"uuid":"481316767","full_name":"Gann4Life/git-cheat-sheet","owner":"Gann4Life","description":"Quick access git cheat sheet.","archived":false,"fork":false,"pushed_at":"2022-05-19T02:19:11.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-17T23:45:12.298Z","etag":null,"topics":["cheatsheet","git","github"],"latest_commit_sha":null,"homepage":"https://gann4life.github.io/git-cheat-sheet","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/Gann4Life.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":"2022-04-13T17:44:47.000Z","updated_at":"2022-05-19T02:21:28.000Z","dependencies_parsed_at":"2023-07-22T00:47:21.209Z","dependency_job_id":null,"html_url":"https://github.com/Gann4Life/git-cheat-sheet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Gann4Life/git-cheat-sheet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gann4Life%2Fgit-cheat-sheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gann4Life%2Fgit-cheat-sheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gann4Life%2Fgit-cheat-sheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gann4Life%2Fgit-cheat-sheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gann4Life","download_url":"https://codeload.github.com/Gann4Life/git-cheat-sheet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gann4Life%2Fgit-cheat-sheet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34379915,"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-15T02:00:07.085Z","response_time":63,"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":["cheatsheet","git","github"],"created_at":"2024-10-10T10:34:35.292Z","updated_at":"2026-06-15T20:31:21.401Z","avatar_url":"https://github.com/Gann4Life.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git Cheat Sheet\n\nGit is the open source distributed version control system that facilitates GitHub activities on your laptop or desktop. This cheat sheet summarizes commonly used Git command line instructions for quick reference.\n\n---\n\n\u003ch3 name=\"index\"\u003eIndex\u003c/h3\u003e\n\n[![Button](https://shields.io/badge/Go%20to-Install-black?style=flat)](#install)\n\n[![Button](https://shields.io/badge/Go%20to-Create%20repositories-black?style=flat)](#create-repositories)\n\n[![Button](https://shields.io/badge/Go%20to-Configure%20tooling-black?style=flat)](#configure-tooling)\n\n[![Button](https://shields.io/badge/Go%20to-The%20.gitignore%20file-black?style=flat)](#gitignore)\n\n[![Button](https://shields.io/badge/Go%20to-Branches-black?style=flat)](#branches)\n\n[![Button](https://shields.io/badge/Go%20to-Synchronize%20changes-black?style=flat)](#synchronize-changes)\n\n[![Button](https://shields.io/badge/Go%20to-Make%20changes-black?style=flat)](#make-changes)\n\n[![Button](https://shields.io/badge/Go%20to-Redo%20changes-black?style=flat)](#redo-changes)\n\n---\n\n\u003ch3 name=\"install\"\u003eInstall\u003c/h3\u003e\n\n* [**GitHub for Windows**](https://windows.github.com)\u003cbr\u003e\n* [**GitHub for Mac**](https://mac.github.com)\u003cbr\u003e\n* [**Git for All Platforms**](https://git-scm.com)\n\n[![Button](https://shields.io/badge/Go%20to-Index-black?style=flat)](#index)\n\n\u003ch3 name=\"create-repositories\"\u003eCreate repositories\u003c/h3\u003e\n\nWhen starting out with a new repository, you only need to do it once; either locally, then push to GitHub, or by cloning an existing repository.\n\n\u003e `$ git init`\u003cbr\u003e\n\u003e Turn an existing directory into a git repository.\n\n\u003e `$ git clone [url]`\u003cbr\u003e\n\u003e Clone (download) a repository that already exists on GitHub, including all of the files, branches and commits.\n\n[![Button](https://shields.io/badge/Go%20to-Index-black?style=flat)](#index)\n\n\u003ch3 name=\"configure-tooling\"\u003eConfigure tooling\u003c/h3\u003e\n\nConfigure user information for all local repositories.\n\n\u003e `$ git config --global user.name \"[name]\"`\u003cbr\u003e\n\u003e Sets the name you want attached to your commit transactions.\n\n\u003e `git config --global user.email \"[email address]\"`\u003cbr\u003e\n\u003e Sets the email you want attached to your commit transactions.\n\n\u003e `$ git config --global color.ui auto`\u003cbr\u003e\n\u003e Enables helpful colorization of command line output.\n\n[![Button](https://shields.io/badge/Go%20to-Index-black?style=flat)](#index)\n\n\u003ch3 name=\"gitignore\"\u003eThe .gitignore file\u003c/h3\u003e\n\nSometimes it may be a good idea to exclude files from being tracked with Git. This is typically done in a special file named `.gitignore`. You can find helpful templates for `.gitignore` files at https://github.com/github/gitignore.\n\n[![Button](https://shields.io/badge/Go%20to-Index-black?style=flat)](#index)\n\n\u003ch3 name=\"branches\"\u003eBranches\u003c/h3\u003e\n\nBranches are an important part of working with Git. Any commits you make will be made on the branch you're currently \"checked out\" to. Use `git status` to see which branch that is.\n\n\u003e `$ git branch [branch-name]`\u003cbr\u003e\n\u003e Creates a new branch.\n\n\u003e `$ git checkout [branch-name]`\u003cbr\u003e\n\u003e Switches to the specified branch and updates the working directory.\n\n\u003e `$ git merge [branch]`\u003cbr\u003e\n\u003e Combines the specified branch's history into the current branch. This is usually done in pull requests, but is an important Git operation.\n\n\u003e `$ git branch -d [branch-name]`\u003cbr\u003e\n\u003e Delete the specified branch.\n\n[![Button](https://shields.io/badge/Go%20to-Index-black?style=flat)](#index)\n\n\u003ch3 name=\"synchronize-changes\"\u003eSynchronize changes\u003c/h3\u003e\n\n\u003e `$ git fetch`\u003cbr\u003e\n\u003e Downloads all history from the remote tracking branches.\n\n\u003e `$ git merge`\u003cbr\u003e\n\u003e Combines remote tracking branch into current local branch.\n\n\u003e `$ git push`\u003cbr\u003e\n\u003eUploads all local branch commits to GitHub.\n\n\u003e `$ git pull`\u003cbr\u003e\n\u003e Updates your current local working branch with all new commits from the corresponding remote branch on GitHub. `git pull` is a combination of `git fetch` and `git merge`.\n\n[![Button](https://shields.io/badge/Go%20to-Index-black?style=flat)](#index)\n\n---\n\n\u003ch3 name=\"make-changes\"\u003eMake changes\u003c/h3\u003e\n\nBrowse and inspect the evolution of project files.\n\n\u003e `$ git log`\u003cbr\u003e\n\u003e Lists version history for the current branch.\n\n\u003e `$ git log --follow [file]`\u003cbr\u003e\n\u003e Lists version history for a file, including renames.\n\n\u003e `$ git diff [first-branch]...[second-branch]`\u003cbr\u003e\n\u003e Shows content differences between two branches.\n\n\u003e `$ git show [commit]`\u003cbr\u003e\n\u003e Outputs metadata and content changes of the specified commit.\n\n\u003e `$ git add [file]`\u003cbr\u003e\n\u003e Snapshots the file in preparation for versioning.\n\n\u003e `$ git commit -m \"[descriptive message]\"`\u003cbr\u003e\n\u003e Records file snapshots permanently in version history.\n\n[![Button](https://shields.io/badge/Go%20to-Index-black?style=flat)](#index)\n\n\u003ch3 name=\"redo-commits\"\u003eRedo commits\u003c/h3\u003e\n\nErase mistakes and craft replacement history.\n\n\u003e `$ git reset [commit]`\u003cbr\u003e\n\u003e Undoes all commits after [commit], preserving changes locally.\n\n\u003e `$ git reset --hard [commit]`\u003cbr\u003e\n\u003e Discards all history and changes back to the specified commit.\n\nCAUTION! Changing history can have nasty side effects. If you need to change commits that exist on GitHub (the remote), proceed with caution. If you need help, reach out at github.community or contact support.\n\n[![Button](https://shields.io/badge/Go%20to-Index-black?style=flat)](#index)\n\n---\n\n\u003ch3 name=\"glossary\"\u003eGlossary\u003c/h3\u003e\n\n**git**: an open source, distributed version-control system.\n\n**GitHub**: a platform for hosting and collaborating on Git repositories.\n\n**commit**: a Git object, a snapshot of your entire repository compressed into a SHA.\n\n**branch**: a lightweight movable pointer to a commit.\n\n**clone**: a local version of a repository, including all commits and branches.\n\n**remote**: a common repository on GitHub that all team member use to exchange their changes.\n\n**fork**: a copy of a repository on GitHub owned by a different user.\n\n**pull request**: a place to compare and discuss the differences introduced on a branch with reviews, comments, integrated tests, and more.\n\n**HEAD**: representing your current working directory, the HEAD pointer can be moved to different branches, tags or commits when using `git checkout`.\n\n[![Button](https://shields.io/badge/Go%20to-Index-black?style=flat)](#index)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgann4life%2Fgit-cheat-sheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgann4life%2Fgit-cheat-sheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgann4life%2Fgit-cheat-sheet/lists"}