{
  "version": 1,
  "collections": [
    {
      "id": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "name": "git",
      "color": "#f05033"
    }
  ],
  "snippets": [
    {
      "id": "90b2a0a0-3c37-580b-8780-007391fb7363",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Set your name",
      "body": "git config --global user.name \"{{name}}\"",
      "description": "",
      "tags": [
        "setup"
      ]
    },
    {
      "id": "095c4f81-0851-51cc-88d7-4aa3b1b87509",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Set your email",
      "body": "git config --global user.email \"{{email}}\"",
      "description": "",
      "tags": [
        "setup"
      ]
    },
    {
      "id": "b7fdc9be-6466-5098-93be-9dccfb70e6b4",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Set the default branch name for new repos",
      "body": "git config --global init.defaultBranch {{branch:main}}",
      "description": "",
      "tags": [
        "setup"
      ]
    },
    {
      "id": "4b010fb0-2e7a-5d8b-bdcb-4e328581391f",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Clone a repository",
      "body": "git clone {{url}}",
      "description": "",
      "tags": [
        "setup"
      ]
    },
    {
      "id": "cd0980c7-a79c-51a5-a7a4-5ee012b944fb",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Clone only recent history",
      "body": "git clone --depth {{depth:1}} {{url}}",
      "description": "Much faster for big repositories when you don’t need the full history.",
      "tags": [
        "setup"
      ]
    },
    {
      "id": "b8e48a34-d06f-5449-a202-f5ed9c5c28fa",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Short status with branch info",
      "body": "git status -sb",
      "description": "",
      "tags": [
        "everyday"
      ]
    },
    {
      "id": "106b8eca-debe-5dab-8ba5-5167b6b6d508",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Stage parts of a file",
      "body": "git add -p",
      "description": "Walks through each change and asks whether to stage it.",
      "tags": [
        "everyday"
      ]
    },
    {
      "id": "edf4986f-c480-5ccc-8eef-2cc4b78107fb",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Commit with a message",
      "body": "git commit -m \"{{message}}\"",
      "description": "",
      "tags": [
        "everyday"
      ]
    },
    {
      "id": "ee0730da-8d2f-5d17-8224-949e4bafef25",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Add changes to the last commit",
      "body": "git commit --amend --no-edit",
      "description": "Stage your fixes first. Don’t amend commits you’ve already pushed to a shared branch.",
      "tags": [
        "everyday"
      ]
    },
    {
      "id": "604fff6a-7da2-5ae4-9268-47a9d421f235",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Show unstaged changes",
      "body": "git diff",
      "description": "",
      "tags": [
        "everyday"
      ]
    },
    {
      "id": "12e54033-6dcf-50be-8f94-b3f3b3437c6f",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Show staged changes",
      "body": "git diff --staged",
      "description": "",
      "tags": [
        "everyday"
      ]
    },
    {
      "id": "e0cba187-b716-5bc7-83f8-ed3810e602f9",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Create a branch and switch to it",
      "body": "git switch -c {{branch}}",
      "description": "",
      "tags": [
        "branches"
      ]
    },
    {
      "id": "95425b3e-81d9-51fd-832d-c5801850dc13",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Switch back to the previous branch",
      "body": "git switch -",
      "description": "",
      "tags": [
        "branches"
      ]
    },
    {
      "id": "9f92b8d6-a3c1-5979-b448-e954be25e5fa",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "List branches, most recent first",
      "body": "git branch --sort=-committerdate",
      "description": "",
      "tags": [
        "branches"
      ]
    },
    {
      "id": "fc3cad45-300b-5b45-a28a-02374851fbf5",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Rename the current branch",
      "body": "git branch -m {{new_name}}",
      "description": "",
      "tags": [
        "branches"
      ]
    },
    {
      "id": "602f063b-30a8-5aa9-a008-fb233abd5280",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Delete a merged branch",
      "body": "git branch -d {{branch}}",
      "description": "Use -D to delete a branch that hasn’t been merged.",
      "tags": [
        "branches"
      ]
    },
    {
      "id": "ccb404b4-ad1e-56ff-8d86-91de2431c5d6",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Delete a remote branch",
      "body": "git push origin --delete {{branch}}",
      "description": "",
      "tags": [
        "branches"
      ]
    },
    {
      "id": "ef9720dd-1a52-5ce4-a0d0-c7473dc593e5",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Delete every local branch already merged",
      "body": "git branch --merged {{base:main}} | grep -vE '^\\*|^\\s*{{base:main}}$' | xargs git branch -d",
      "description": "Keeps the current branch and the base branch.",
      "tags": [
        "branches"
      ]
    },
    {
      "id": "47686164-bbd9-52f7-b788-ea753669458e",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Fetch and drop deleted remote branches",
      "body": "git fetch --prune",
      "description": "",
      "tags": [
        "syncing"
      ]
    },
    {
      "id": "ae806b8a-0b87-5303-bf4f-b1b8f638e73e",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Pull, rebasing your commits on top",
      "body": "git pull --rebase",
      "description": "",
      "tags": [
        "syncing"
      ]
    },
    {
      "id": "384bfe74-5477-5593-a3e7-71c93fb52e70",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Push a new branch and track it",
      "body": "git push -u origin HEAD",
      "description": "",
      "tags": [
        "syncing"
      ]
    },
    {
      "id": "4510614a-609b-5264-8011-7331d9c45700",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Force push without clobbering others’ work",
      "body": "git push --force-with-lease",
      "description": "Refuses if someone else pushed since you last fetched.",
      "tags": [
        "syncing"
      ]
    },
    {
      "id": "01e6c140-771c-5812-8690-7ce127365c3e",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Add a remote",
      "body": "git remote add {{name:upstream}} {{url}}",
      "description": "",
      "tags": [
        "syncing"
      ]
    },
    {
      "id": "8e73e16c-ee3b-5120-a80e-9be077bce40d",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Update a fork from upstream",
      "body": "git fetch upstream && git rebase upstream/{{branch:main}}",
      "description": "",
      "tags": [
        "syncing"
      ]
    },
    {
      "id": "df50b1ae-de44-5aa7-945b-7ccc00540fa0",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Undo the last commit, keep the changes",
      "body": "git reset --soft HEAD~{{count:1}}",
      "description": "",
      "tags": [
        "undo"
      ]
    },
    {
      "id": "0524a465-bde7-50c7-97b1-123947867506",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Unstage a file",
      "body": "git restore --staged {{file}}",
      "description": "",
      "tags": [
        "undo"
      ]
    },
    {
      "id": "4e82b762-46e3-5476-ac7a-ecfe94400efa",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Discard changes to a file",
      "body": "git restore {{file}}",
      "description": "",
      "tags": [
        "undo"
      ]
    },
    {
      "id": "95d7db94-b0a0-5e8c-b03f-d76d558d6f85",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Make the branch match the remote",
      "body": "git fetch && git reset --hard origin/{{branch:main}}",
      "description": "Throws away local commits and changes.",
      "tags": [
        "undo"
      ]
    },
    {
      "id": "2c4f2b81-6fe3-5cc0-91e2-950cde177723",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Revert a commit with a new commit",
      "body": "git revert {{commit}}",
      "description": "The safe way to undo something that’s already pushed.",
      "tags": [
        "undo"
      ]
    },
    {
      "id": "c0ae9f50-7ed0-53b5-abfa-106f577fdff4",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Find a lost commit",
      "body": "git reflog",
      "description": "Every place HEAD has been. Find the commit, then git switch -c rescue <commit>.",
      "tags": [
        "undo"
      ]
    },
    {
      "id": "d4f35544-031a-5cc6-8fe3-592b40c284e4",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Preview deleting untracked files",
      "body": "git clean -fdn",
      "description": "Lists what would be deleted. Run again without -n to delete.",
      "tags": [
        "undo"
      ]
    },
    {
      "id": "a0912c4a-f45e-53d6-b4c8-c67e10dfbcda",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Stash everything, including new files",
      "body": "git stash push -u -m \"{{message}}\"",
      "description": "",
      "tags": [
        "stash"
      ]
    },
    {
      "id": "353c426e-90ae-52b4-ab0b-2a2226d80ce1",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "List stashes",
      "body": "git stash list",
      "description": "",
      "tags": [
        "stash"
      ]
    },
    {
      "id": "6c0500e2-1d5c-5cac-badf-1f3f8474925c",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Apply the latest stash and drop it",
      "body": "git stash pop",
      "description": "",
      "tags": [
        "stash"
      ]
    },
    {
      "id": "5fc9ca03-5740-5ca6-b751-aa8115d41d03",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Apply a specific stash",
      "body": "git stash apply stash@{{{index:0}}}",
      "description": "",
      "tags": [
        "stash"
      ]
    },
    {
      "id": "93567da1-c8c3-5d8b-85ac-2e600675eb5b",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Stash just one file",
      "body": "git stash push {{file}}",
      "description": "",
      "tags": [
        "stash"
      ]
    },
    {
      "id": "39a11272-5693-58a0-a737-93c9324610e8",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "One-line log graph",
      "body": "git log --oneline --graph --decorate --all -n {{count:30}}",
      "description": "",
      "tags": [
        "history"
      ]
    },
    {
      "id": "6d35e6bd-4340-5234-a40e-c1f2fe16c410",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "History of a file, with diffs",
      "body": "git log -p --follow -- {{file}}",
      "description": "",
      "tags": [
        "history"
      ]
    },
    {
      "id": "bbef4c5f-7046-587d-83a6-6bddd218812e",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Search commit messages",
      "body": "git log --oneline --grep=\"{{text}}\"",
      "description": "",
      "tags": [
        "history"
      ]
    },
    {
      "id": "9137733d-7b63-54df-82ce-e9b75b724d57",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Find commits that added or removed text",
      "body": "git log -S \"{{text}}\" --oneline",
      "description": "",
      "tags": [
        "history"
      ]
    },
    {
      "id": "9cb5e727-f0b7-56df-b884-fe2a86b07b96",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Who last changed these lines",
      "body": "git blame -L {{start}},{{end}} {{file}}",
      "description": "",
      "tags": [
        "history"
      ]
    },
    {
      "id": "3cfe0827-0a21-5243-89b7-a24f835c029a",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Show a file as it was at a commit",
      "body": "git show {{commit}}:{{path}}",
      "description": "",
      "tags": [
        "history"
      ]
    },
    {
      "id": "e5d48e04-cd9b-51de-9fd6-f0f41b642b13",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Commits on this branch that aren’t on main",
      "body": "git log --oneline {{base:main}}..HEAD",
      "description": "",
      "tags": [
        "history"
      ]
    },
    {
      "id": "cedaffae-0202-5a07-bc65-184f5ff9d073",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Interactive rebase",
      "body": "git rebase -i {{base:main}}",
      "description": "Squash, reword or reorder commits before opening a pull request.",
      "tags": [
        "rewriting"
      ]
    },
    {
      "id": "a94f0ef8-ee1e-53f2-a75e-fabb9fd36c82",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Squash fixups automatically",
      "body": "git rebase -i --autosquash {{base:main}}",
      "description": "Pairs with git commit --fixup <commit>.",
      "tags": [
        "rewriting"
      ]
    },
    {
      "id": "be33163b-5f9f-5510-bd0c-71dc50aa4274",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Copy a commit onto this branch",
      "body": "git cherry-pick {{commit}}",
      "description": "",
      "tags": [
        "rewriting"
      ]
    },
    {
      "id": "53908e78-13fa-54e7-8c9c-e7a4fd7c1fec",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Abort a rebase or merge in progress",
      "body": "git {{operation:rebase|merge|cherry-pick}} --abort",
      "description": "",
      "tags": [
        "rewriting"
      ]
    },
    {
      "id": "53f8caa8-7e3a-51d2-ab17-e6253cdea4f5",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Find the commit that broke something",
      "body": "git bisect start && git bisect bad && git bisect good {{good_commit}}",
      "description": "Then mark each commit good or bad; git bisect reset when done.",
      "tags": [
        "rewriting"
      ]
    },
    {
      "id": "6f017525-da2c-55a2-b063-6b04bf7217f3",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Create an annotated tag",
      "body": "git tag -a {{tag}} -m \"{{message}}\"",
      "description": "",
      "tags": [
        "tags"
      ]
    },
    {
      "id": "04c6e4da-ddba-5d14-9f84-a7521c3956f2",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Push tags",
      "body": "git push origin --tags",
      "description": "",
      "tags": [
        "tags"
      ]
    },
    {
      "id": "36b0baf7-48ee-57b8-b5bb-4605389009da",
      "collectionId": "daa014df-4945-55f3-a43e-460b7ec77df3",
      "title": "Check out a branch in another folder",
      "body": "git worktree add ../{{folder}} {{branch}}",
      "description": "Work on two branches at once without stashing.",
      "tags": [
        "tags"
      ]
    }
  ]
}
