{"id":17060843,"url":"https://github.com/sebastianboldt/git-cheatsheet","last_synced_at":"2025-10-12T17:07:26.258Z","repository":{"id":76939985,"uuid":"80096469","full_name":"SebastianBoldt/Git-Cheatsheet","owner":"SebastianBoldt","description":"🐱A Cheatsheet for Git ","archived":false,"fork":false,"pushed_at":"2022-08-24T07:26:45.000Z","size":49,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T14:48:02.059Z","etag":null,"topics":["git","git-cheatsheet"],"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/SebastianBoldt.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":"2017-01-26T08:11:18.000Z","updated_at":"2022-08-15T07:19:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"d2002329-62b0-460c-82ed-70c1ee0bfd35","html_url":"https://github.com/SebastianBoldt/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/SebastianBoldt%2FGit-Cheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebastianBoldt%2FGit-Cheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebastianBoldt%2FGit-Cheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebastianBoldt%2FGit-Cheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SebastianBoldt","download_url":"https://codeload.github.com/SebastianBoldt/Git-Cheatsheet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245072264,"owners_count":20556353,"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":["git","git-cheatsheet"],"created_at":"2024-10-14T10:45:22.175Z","updated_at":"2025-10-12T17:07:21.216Z","avatar_url":"https://github.com/SebastianBoldt.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git-Cheatsheet\nA Cheatsheet for Git \n\n## Fundamentals\n| Term | Description |\n| ----------- | ----------- |\n| Working Tree | Directory where modifications are made |\n| HEAD | Symbolic Reference to the most current checked out commit - can be detached so it points to another commit |\n| Index(Staging Area) | This is where commits will be prepared |\n| Repository | Different states of files will be tracked inside the Repository |\n\n![Cheat: Terminal Cheatsheet](https://github.com/SebastianBoldt/Git-Cheatsheet/blob/e12a338944a5ca89aae5298119f7c96a81f52e8f/Images/index.png?raw=true)\n\n## Commands \n\n| Command | Description |\n| ----------- | ----------- |\n| git config --global user.name \"Max Mustermann\" | Configure global username |\n| git config --global user.email \"m.mustermann@example.com\" | Configure global email adress |\n| git config -l | show all configurations for current repo |\n| git config alias.\\\u003calias-name\\\u003e \\\u003calias\\\u003e | create a alias |\n| git config --global alias.\\\u003calias-name\\\u003e \\`config --global\\` | create alias with parameters |\n| git config color.ui auto | set color options to automatic mode |\n| git init example  | initalise git repository |\n| git status | show current repository status |\n| git add file | add file to the staging area|\n| git add . | add all changes made to the staging area |\n| git add --p | git will ask you which files/parts of these files you want to add to the staging area |\n| git commit -m \"First Commit\" | Commit changes to current branch |\n| git commit --amend | Repair commit (SHA-1 Hash will change) |\n| git show | show last commit message etc. |\n| git show HEAD | show newest commit |\n| git show master | show latest commit of branch master |\n| git show 77cc0045 | show commit with hash 77cc0045 |\n| git log | show all commits |\n| git diff | show difference between working tree, staging area and repo |\n| git diff --staging | show difference between staging area and repo |\n| git reset A.txt | Removes file from staging area |\n| git reset HEAD | reset the staging area  |\n| git reset --p | git will ask you which files you want to remove from the staging area |\n| git reset HEAD~3 | resets current branch to HEAD - 3 Commit |\n| git revert COMMIT_HASH | reverts to old state by creating a new commit |\n| git branch BRANCHNAME | creates a new branch named BRANCHNAME |\n| git checkout BRANCHNAME | moving to a branch with the name BRANCHNAME |\n| git checkout COMMIT_HASH | detach HEAD and move it to the commit with the hash COMMIT_HASH |\n| git checkout main^ | moves head to previous commit |\n| git checkout main^2 | if current commit is merge commit it checks out the second one | \n| git rebase BRANCHNAME | rebasing the current branch to BRANCHNAME |\n| git rebase -i HEAD~4 | start an interactive rebase to change the last 4 commits |\n| git checkout HEAD^ | moves HEAD one commit back in time |\n| git checkout HEAD~ | moves HEAD to previous commit |\n| git branch -f main HEAD~3 | moves branch to HEAD - 3 Commit |\n| git cherry-pick HASH1 HASH2 ... | pick all the commits and apply them to the current branch |\n| git tag v1 COMMIT_HASH | append tag v1 to commit with hash COMMIT_HASH |\n| git describe TAGNAME | shows you how many commit are between you and the tag with name TAGNAME (v2_1_gC4) -\u003e (NEXT-TAG_NUMBEROFCOMMITS_COMMITHASH) |\n| git checkout -b not_main origin/main | creates a local branch not_main that tracks the remote branch main |\n| git branch -u origin/main foo | let foo track remote branch origin/main so push and pull operate on it |\n| git fetch | moves changes to local remote tracking branch |\n| git pull | fetches all changes and merges them in corresponding local branch |\n| get pull --rebase | fetches all changes and rebases them before on the current branch commits |\n| git push origin main | pushes all changes from main to origin main |\n| git push origin SOURCE:DESTINATION | pushes all changes from local SOURCE to remote DESTINATION on origin |\n| git push origin main^:foo | pushes all changes from local main - 1 commit to remote foo on origin |\n\n## Files\n\n| Filename | Description |\n| ----------- | ----------- |\n| ~/.gitconfig  | Configuration for all repositories - global |\n| /etc/gitconfig | system wide configurations |\n\n... to be continued.\n\n## Update Tags\n\ngit tag -l | xargs git tag -d\n\ngit fetch --tags\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebastianboldt%2Fgit-cheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebastianboldt%2Fgit-cheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebastianboldt%2Fgit-cheatsheet/lists"}