{
    "componentChunkName": "component---src-templates-blog-post-js",
    "path": "/git-cheatsheet/",
    "result": {"data":{"markdownRemark":{"html":"<p><del>git init</del></p>\n<ul>\n<li>Initializes the current folder as a Git repository.</li>\n</ul>\n<p><del>git clone <url></del></p>\n<ul>\n<li>Clone an existing Git repository.</li>\n</ul>\n<p><del>git remote add origin <url></del></p>\n<ul>\n<li>Push the local repository to GitHub.</li>\n</ul>\n<p><del>git status</del></p>\n<ul>\n<li>Current status of the folder.</li>\n</ul>\n<p><del>git add .</del></p>\n<p>Add all the files in the current folder to the staging area.</p>\n<p><del>git commit -m COMMIT_MESSAGE</del></p>\n<p>Commit the changes to the Git repository.</p>\n<p><del>git push -u origin master</del></p>\n<p>Push the contents of the local repository to the origin to the master branch.</p>\n<p><del>git log --oneline</del></p>\n<p>See the commit history in a Git repository in a single line.</p>\n<p><del>git restore FILE_NAME</del></p>\n<p>You added some code in the file but you want to revert back to the state of the file before you added the code. (<em>You have not staged the file yet.</em>)</p>\n<p><del>git restore --staged FILE_NAME</del></p>\n<p>Unstage a staged file.</p>\n<h3 id=\"git-branches\" style=\"position:relative;\"><a href=\"#git-branches\" aria-label=\"git branches permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Git Branches</h3>\n<p><del>git checkout -b BRANCH_NAME</del></p>\n<p>Create a branch.</p>\n<p><del>git branch -a</del></p>\n<p>To view both remote tracking branches and local branches.</p>\n<p><del>git checkout BRANCH_NAME</del></p>\n<p>To checkout an existing branch.</p>\n<p>Generally, Git won’t let you checkout another branch unless your working directory is clean, because you would lose any working directory changes that are not committed.</p>\n<p><del>git branch m OLD_BRANCH_NAME NEW_BRANCH_NAME</del></p>\n<p>Rename a branch.</p>\n<p><del>git branch -d BRANCH_TO_DELETE</del></p>\n<p>Delete a branch.</p>\n<p>Git won’t let you delete a branch that you are currently on. You first need to checkout a different branch and then run the command.</p>\n<p><del>git branch -D BRANCH_TO_DELETE</del></p>\n<p>Git will throw an error if the changes in the branch you are trying to delete are not fully merged into the current branch. You can override this and force Git to delete the branch with the <del>-D</del> option (‘D’ is in capital).</p>\n<p><del>git push -u origin BRANCH_NAME</del></p>\n<p>Push your branch to the remote repository.</p>\n<p><del>git push origin --delete BRANCH_TO_DELETE</del></p>\n<p>Delete a branch remotely.</p>\n<p><del>git checkout master</del></p>\n<p>Checkout to master branch.</p>\n<p><del>git merge BRANCH_NAME</del></p>\n<p>Merges the specified branch into the currently active branch.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    position: relative;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n    line-height: 1.4;\n  }\n  \n  .grvsc-code {\n    display: table;\n  }\n  \n  .grvsc-line {\n    display: table-row;\n    box-sizing: border-box;\n    width: 100%;\n    position: relative;\n  }\n  \n  .grvsc-line > * {\n    position: relative;\n  }\n  \n  .grvsc-gutter-pad {\n    display: table-cell;\n    padding-left: 0.75rem;\n    padding-left: calc(var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem)) / 2);\n  }\n  \n  .grvsc-gutter {\n    display: table-cell;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    user-select: none;\n  }\n  \n  .grvsc-gutter::before {\n    content: attr(data-content);\n  }\n  \n  .grvsc-source {\n    display: table-cell;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-source:empty::after {\n    content: ' ';\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    user-select: none;\n  }\n  \n  .grvsc-gutter + .grvsc-source {\n    padding-left: 0.75rem;\n    padding-left: calc(var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem)) / 2);\n  }\n  \n  /* Line transformer styles */\n  \n  .grvsc-has-line-highlighting > .grvsc-code > .grvsc-line::before {\n    content: ' ';\n    position: absolute;\n    width: 100%;\n  }\n  \n  .grvsc-line-diff-add::before {\n    background-color: var(--grvsc-line-diff-add-background-color, rgba(0, 255, 60, 0.2));\n  }\n  \n  .grvsc-line-diff-del::before {\n    background-color: var(--grvsc-line-diff-del-background-color, rgba(255, 0, 20, 0.2));\n  }\n  \n  .grvsc-line-number {\n    padding: 0 2px;\n    text-align: right;\n    opacity: 0.7;\n  }\n  \n</style>","frontmatter":{"title":"Git Cheat Sheet","date":"2021-05-21"}}},"pageContext":{"slug":"/git-cheatsheet/","prev":{"fields":{"slug":"/a-beginners-guide-to-prototypes-and-prototypal-inheritance-in-javascript/"},"frontmatter":{"modules":null}},"next":{"fields":{"slug":"/how-to-add-custom-environment-variables-in-react/"},"frontmatter":{"modules":null}}}},
    "staticQueryHashes": ["3159585216"]}