{"componentChunkName":"component---src-pages-author-author-yaml-id-js","path":"/author/abhimanyu-singh-rathore/","result":{"data":{"allMarkdownRemark":{"edges":[{"node":{"id":"51149b1a-0e78-555a-a74e-01bd7e137dfa","html":"<p>Github is great, as you may already know.</p>\n<p>But, did you ever think to make your profile attractive for potential employers, followers, recruiters, and visitors?</p>\n<p>Let's make a better version of it.</p>\n<h2 id=\"github-profile-image-frame\" style=\"position:relative;\"><a href=\"#github-profile-image-frame\" aria-label=\"github profile image frame 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>Github Profile Image Frame</h2>\n<p>It's up to you to decide how you want this frame — photo-less, cartoon avatar, or best explaining image.</p>\n<p>For the best image, take a quality click; quality means not blurred, perfect lighting, and good posture.\nIf someone looks at the photo, it shall explain your personality.</p>\n<h2 id=\"github-profile-page\" style=\"position:relative;\"><a href=\"#github-profile-page\" aria-label=\"github profile page 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>Github Profile Page</h2>\n<p>Github has a <a href=\"https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme\">feature called README</a> if you do not know already.</p>\n<p>Check out some listing of <a href=\"https://github.com/abhisheknaiidu/awesome-github-profile-readme\">awesome GitHub profiles</a>.</p>\n<p>To start this, first, you need to create a project that is the same as your GitHub username.</p>\n<p><strong>Example:</strong> My user name is <code>abhir9</code>, and I need to create a repo with the same name <code>abhir9</code> with a <code>README.md</code> file.</p>\n<p>This <code>README.me</code> will act as the profile page: <a href=\"https://github.com/abhir9\">abhir9</a></p>\n<p>It is the actual README file created using a repo with my GitHub username: <a href=\"https://github.com/abhir9/abhir9/blob/main/README.md\">abhir9</a></p>\n<p>Here you can add your quotes, hello statement, greetings, etc. It is connected to the viewer on your behalf.</p>\n<p>So write a short paragraph or a brief story to introduce yourself.</p>\n<p>There are some apps from contributors that extract the information based on your profile name and share stats and charts.</p>\n<ul>\n<li><a href=\"https://github-readme-stats.vercel.app\">github readme stats</a>\ne.g.: <code>https://github-readme-stats.vercel.app/api?username=abhir9&#x26;show_icons=true&#x26;count_private=true&#x26;theme=react</code></li>\n<li><a href=\"https://readme-typing-svg.herokuapp.com\">readme typing svg</a>\ne.g.: <code>https://readme-typing-svg.herokuapp.com?size=50&#x26;center=true&#x26;vCenter=true&#x26;width=800&#x26;height=100&#x26;lines=Namaste%20%F0%9F%99%8F%3BPranam%20%F0%9F%99%8F%3BKhamma%20Ghani%20%F0%9F%99%8F%3BVanakkam%20%F0%9F%99%8F%3BSat%20Sri%20Akaal%20%F0%9F%99%8F%3BAssalam%20Alaikum%20%F0%9F%99%8F%3B</code></li>\n<li><a href=\"https://views.whatilearened.today\">whatilearened</a>\ne.g.: <code>https://views.whatilearened.today/views/github/abhir9/abhir9.svg?cache=remove</code></li>\n<li><a href=\"https://github-readme-streak-stats.herokuapp.com\">github readme streak stats</a>\ne.g.: <code>https://github-readme-streak-stats.herokuapp.com/?user=abhir9&#x26;theme=react</code></li>\n<li>SVG Icons\ne.g.: <code>https://raw.githubusercontent.com/devicons/devicon/master/icons/ubuntu/ubuntu-plain.svg</code></li>\n</ul>\n<p>Many other online apps can be used per your need — e.g., how you want to decorate your profile page.</p>\n<h2 id=\"github-pinned-repos\" style=\"position:relative;\"><a href=\"#github-pinned-repos\" aria-label=\"github pinned repos 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>Github Pinned Repos</h2>\n<p>Github allows you to pin up to 6 repos.</p>\n<p>Try to pin the best of your projects' repos. Mostly, people do visit these repos if they land on your profiles.</p>\n<h2 id=\"greeny-contributions\" style=\"position:relative;\"><a href=\"#greeny-contributions\" aria-label=\"greeny contributions 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>Greeny Contributions</h2>\n<p>There is a heat map that represents your contributions.</p>\n<p>Heat map graph will automatically generate as per your contributions. Try to keep it greener by contributing usefully to your favorite projects.</p>\n<h2 id=\"readme-for-every-project\" style=\"position:relative;\"><a href=\"#readme-for-every-project\" aria-label=\"readme for every project 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>README for Every Project</h2>\n<p>Whether it's a minor or significant project, add a well-descriptive README file. It helps anyone clearly understand what your project does and how they can contribute if they want to.</p>\n<p>Format it in a better way; if you don't know very much about Markdown format, you can use an online tool like <a href=\"https://pandao.github.io/editor.md/en.html\">Pandao</a></p>\n<p>You can use images, screenshots, gifs, resources list, contribution guidelines, license, etc.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"How to Build Your Github Profile","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"February 28, 2022","updated_date":null,"tags":["Github"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/91552ab64061624f85043adb83cc0973/ee604/index.png","srcSet":"/static/91552ab64061624f85043adb83cc0973/69585/index.png 200w,\n/static/91552ab64061624f85043adb83cc0973/497c6/index.png 400w,\n/static/91552ab64061624f85043adb83cc0973/ee604/index.png 800w,\n/static/91552ab64061624f85043adb83cc0973/f3583/index.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/build-your-github-profile/"}}},{"node":{"id":"70a76127-98dc-5ec2-bf52-0dc9d91965ac","html":"<p>There is an advanced feature of React that it can write renderers for multiple different env. Let discuss a few of them.</p>\n<h2 id=\"react-figma\" style=\"position:relative;\"><a href=\"#react-figma\" aria-label=\"react figma 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><a href=\"https://github.com/react-figma/react-figma\" title=\"React-Figma\">React-Figma</a></h2>\n<p>This is a Renderer for Figma. It can use React components as a design source.</p>\n<p>Sample code with react-figma:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk4\">*</span><span class=\"mtk1\"> </span><span class=\"mtk15\">as</span><span class=\"mtk1\"> </span><span class=\"mtk12\">React</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;react&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Page</span><span class=\"mtk1\">, </span><span class=\"mtk12\">View</span><span class=\"mtk1\">, </span><span class=\"mtk12\">Text</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;react-figma&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">export</span><span class=\"mtk1\"> </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk11\">App</span><span class=\"mtk1\"> = () </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> (</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Page</span><span class=\"mtk1\"> </span><span class=\"mtk12\">name</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;My Resume&quot;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">isCurrent</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">View</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">                </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">View</span><span class=\"mtk1\"> </span><span class=\"mtk12\">style</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">{ </span><span class=\"mtk12\">width:</span><span class=\"mtk1\"> </span><span class=\"mtk7\">200</span><span class=\"mtk1\">, </span><span class=\"mtk12\">height:</span><span class=\"mtk1\"> </span><span class=\"mtk7\">100</span><span class=\"mtk1\">, </span><span class=\"mtk12\">backgroundColor:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;#dd423a&#39;</span><span class=\"mtk1\"> }</span><span class=\"mtk4\">}</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span><span class=\"mtk1\">                </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Text</span><span class=\"mtk1\"> </span><span class=\"mtk12\">style</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">{ </span><span class=\"mtk12\">color:</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;white&#39;</span><span class=\"mtk1\"> }</span><span class=\"mtk4\">}</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">Hi, There</span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Text</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">            </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">View</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Page</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    );</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">};</span></span></code></pre>\n<p>Nowadays, Figma is the most popular design tool,  similar renderers available as well: <code>react-sketchapp</code> for Sketch, <code>react-x</code>d for Adobe XD.</p>\n<h2 id=\"react-hardware\" style=\"position:relative;\"><a href=\"#react-hardware\" aria-label=\"react hardware 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><a href=\"https://github.com/iamdustan/react-hardware\" title=\"React Hardware\">React Hardware</a></h2>\n<p>A device like Arduino can be operated by React components. </p>\n<p>Let's checkout demo code :</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">React</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;react&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">ReactHardware</span><span class=\"mtk1\">, {</span><span class=\"mtk12\">Led</span><span class=\"mtk1\">} </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;react-hardware&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk11\">App</span><span class=\"mtk1\"> = () </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> [</span><span class=\"mtk12\">ledStage</span><span class=\"mtk1\">, </span><span class=\"mtk12\">setLedStage</span><span class=\"mtk1\">] = </span><span class=\"mtk11\">useState</span><span class=\"mtk1\">(</span><span class=\"mtk4\">false</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">useEffect</span><span class=\"mtk1\">(() </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk11\">setInterval</span><span class=\"mtk1\">(() </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk11\">setLedStage</span><span class=\"mtk1\">(</span><span class=\"mtk12\">prev</span><span class=\"mtk1\"> </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> !</span><span class=\"mtk12\">prev</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }, </span><span class=\"mtk7\">2000</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }, []);</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Led</span><span class=\"mtk1\"> </span><span class=\"mtk12\">pin</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk7\">13</span><span class=\"mtk4\">}</span><span class=\"mtk1\"> </span><span class=\"mtk12\">value</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk12\">ledStage</span><span class=\"mtk1\"> ? </span><span class=\"mtk7\">255</span><span class=\"mtk1\"> : </span><span class=\"mtk7\">0</span><span class=\"mtk4\">}</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">PORT</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&#39;dev/tty.usbmodem1411&#39;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">ReactHardware</span><span class=\"mtk1\">.</span><span class=\"mtk11\">render</span><span class=\"mtk1\">(</span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">App</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">PORT</span><span class=\"mtk1\">);</span></span></code></pre>\n<h2 id=\"ink\" style=\"position:relative;\"><a href=\"#ink\" aria-label=\"ink 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><a href=\"https://github.com/vadimdemedes/ink\" title=\"Ink\">Ink</a></h2>\n<p>Another React solution for CLIs. It allows you to run, build and test your CLI output through components:</p>\n<p>The code of the demo:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk11\">Raiser</span><span class=\"mtk1\"> = () </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> [</span><span class=\"mtk12\">i</span><span class=\"mtk1\">, </span><span class=\"mtk12\">setI</span><span class=\"mtk1\">] = </span><span class=\"mtk11\">useState</span><span class=\"mtk1\">(</span><span class=\"mtk7\">0</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">useEffect</span><span class=\"mtk1\">(() </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk11\">setInterval</span><span class=\"mtk1\">(() </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk11\">setI</span><span class=\"mtk1\">(</span><span class=\"mtk12\">prev</span><span class=\"mtk1\"> </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">prev</span><span class=\"mtk1\"> + </span><span class=\"mtk7\">1</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }, </span><span class=\"mtk7\">200</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }, []);</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Color</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    Increased by </span><span class=\"mtk4\">{</span><span class=\"mtk12\">i</span><span class=\"mtk4\">}</span><span class=\"mtk1\"> </span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">\t</span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Color</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Ink is a popular one that is used by libraries such a Gatsby, Parcel, Yarn 2, etc.\n<code>react-blessed</code> is one of the similar libraries.</p>\n<h2 id=\"react-three-fiber\" style=\"position:relative;\"><a href=\"#react-three-fiber\" aria-label=\"react three fiber 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><a href=\"https://github.com/pmndrs/react-three-fiber\" title=\"react-three-fiber\">react-three-fiber</a></h2>\n<p>This is a great  React renderer for threejs on the react-native and web.</p>\n<p>Let's see a sample code:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">ReactDOM</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;react-dom&#39;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">React</span><span class=\"mtk1\">, { </span><span class=\"mtk12\">useRef</span><span class=\"mtk1\">, </span><span class=\"mtk12\">useState</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;react&#39;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">Canvas</span><span class=\"mtk1\">, </span><span class=\"mtk12\">useFrame</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;react-three-fiber&#39;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">MyFrame</span><span class=\"mtk1\">(</span><span class=\"mtk12\">props</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">Ref</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">useRef</span><span class=\"mtk1\">()</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> [</span><span class=\"mtk12\">hover</span><span class=\"mtk1\">, </span><span class=\"mtk12\">setOnHover</span><span class=\"mtk1\">] = </span><span class=\"mtk11\">useState</span><span class=\"mtk1\">(</span><span class=\"mtk4\">false</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> [</span><span class=\"mtk12\">enable</span><span class=\"mtk1\">, </span><span class=\"mtk12\">setEnable</span><span class=\"mtk1\">] = </span><span class=\"mtk11\">useState</span><span class=\"mtk1\">(</span><span class=\"mtk4\">false</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">useFrame</span><span class=\"mtk1\">(() </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">Ref</span><span class=\"mtk1\">.</span><span class=\"mtk12\">current</span><span class=\"mtk1\">.</span><span class=\"mtk12\">rotation</span><span class=\"mtk1\">.</span><span class=\"mtk12\">x</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">Ref</span><span class=\"mtk1\">.</span><span class=\"mtk12\">current</span><span class=\"mtk1\">.</span><span class=\"mtk12\">rotation</span><span class=\"mtk1\">.</span><span class=\"mtk12\">y</span><span class=\"mtk1\"> += </span><span class=\"mtk7\">0.01</span><span class=\"mtk1\">))</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> (</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Ref</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">{</span><span class=\"mtk1\">...</span><span class=\"mtk12\">props</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk12\">ref</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk12\">Ref</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk12\">scale</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk12\">enable</span><span class=\"mtk1\"> ? [</span><span class=\"mtk7\">1.5</span><span class=\"mtk1\">, </span><span class=\"mtk7\">1.5</span><span class=\"mtk1\">, </span><span class=\"mtk7\">1.5</span><span class=\"mtk1\">] : [</span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">1</span><span class=\"mtk1\">]</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk12\">onClick</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">(</span><span class=\"mtk12\">e</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk11\">setEnable</span><span class=\"mtk1\">(!</span><span class=\"mtk12\">enable</span><span class=\"mtk1\">)</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk12\">onPointerOver</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">(</span><span class=\"mtk12\">e</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk11\">setOnHover</span><span class=\"mtk1\">(</span><span class=\"mtk4\">true</span><span class=\"mtk1\">)</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk12\">onPointerOut</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">(</span><span class=\"mtk12\">e</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk11\">setOnHover</span><span class=\"mtk1\">(</span><span class=\"mtk4\">false</span><span class=\"mtk1\">)</span><span class=\"mtk4\">}</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">boxBufferGeometry</span><span class=\"mtk1\"> </span><span class=\"mtk12\">args</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">[</span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">1</span><span class=\"mtk1\">, </span><span class=\"mtk7\">1</span><span class=\"mtk1\">]</span><span class=\"mtk4\">}</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">meshStandardMaterial</span><span class=\"mtk1\"> </span><span class=\"mtk12\">color</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk12\">hover</span><span class=\"mtk1\"> ? </span><span class=\"mtk8\">&#39;hotpink&#39;</span><span class=\"mtk1\"> : </span><span class=\"mtk8\">&#39;orange&#39;</span><span class=\"mtk4\">}</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Ref</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  )</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk12\">ReactDOM</span><span class=\"mtk1\">.</span><span class=\"mtk11\">render</span><span class=\"mtk1\">(</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Canvas</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">pointLight</span><span class=\"mtk1\"> </span><span class=\"mtk12\">position</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">[</span><span class=\"mtk7\">10</span><span class=\"mtk1\">, </span><span class=\"mtk7\">10</span><span class=\"mtk1\">, </span><span class=\"mtk7\">10</span><span class=\"mtk1\">]</span><span class=\"mtk4\">}</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">MyFrame</span><span class=\"mtk1\"> </span><span class=\"mtk12\">position</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">[-</span><span class=\"mtk7\">3.2</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">]</span><span class=\"mtk4\">}</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">MyFrame</span><span class=\"mtk1\"> </span><span class=\"mtk12\">position</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk1\">[</span><span class=\"mtk7\">2.2</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">, </span><span class=\"mtk7\">0</span><span class=\"mtk1\">]</span><span class=\"mtk4\">}</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Canvas</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">,</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk12\">document</span><span class=\"mtk1\">.</span><span class=\"mtk11\">getElementById</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;root&#39;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">)</span></span></code></pre>\n<p>The library has a great ecosystem along with packages such as <code>react-three-flex</code> ,<code>react-xr</code>, <code>react-postprocessing</code> , etc.</p>\n<h2 id=\"react-nil\" style=\"position:relative;\"><a href=\"#react-nil\" aria-label=\"react nil 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><a href=\"https://github.com/pmndrs/react-nil\" title=\"react-nil\">react-nil</a></h2>\n<p>A renderer for React that render nothing.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">React</span><span class=\"mtk1\">, { </span><span class=\"mtk12\">useState</span><span class=\"mtk1\">, </span><span class=\"mtk12\">useEffect</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;react&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">render</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;react-nil&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">MyComponent</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> [</span><span class=\"mtk12\">active</span><span class=\"mtk1\">, </span><span class=\"mtk12\">set</span><span class=\"mtk1\">] = </span><span class=\"mtk11\">useState</span><span class=\"mtk1\">(</span><span class=\"mtk4\">false</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk11\">useEffect</span><span class=\"mtk1\">(() </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk4\">void</span><span class=\"mtk1\"> </span><span class=\"mtk11\">setInterval</span><span class=\"mtk1\">(() </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk11\">set</span><span class=\"mtk1\">((</span><span class=\"mtk12\">active</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> !</span><span class=\"mtk12\">active</span><span class=\"mtk1\">), </span><span class=\"mtk7\">1000</span><span class=\"mtk1\">), [])</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> </span><span class=\"mtk4\">null</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">render</span><span class=\"mtk1\">(</span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">MyComponent</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>It provides you kind of high-level abstraction to Node.</p>\n<h2 id=\"react-docx\" style=\"position:relative;\"><a href=\"#react-docx\" aria-label=\"react docx 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><a href=\"https://github.com/Jeday/react-docx\" title=\"react-docx\">react-docx</a></h2>\n<p>Another reconciler for DOCX.js. </p>\n<p>Let's understand with a sample code:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk11\">renderAsyncDocument</span><span class=\"mtk1\">(</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">section</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">paragraph</span><span class=\"mtk1\"> </span><span class=\"mtk12\">heading</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk12\">Docx</span><span class=\"mtk1\">.</span><span class=\"mtk12\">HeadingLevel</span><span class=\"mtk1\">.</span><span class=\"mtk12\">HEADING_1</span><span class=\"mtk4\">}</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      This is a sample paragraph with paragraph tag</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">paragraph</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">p</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">      This is a sample paragraph with P tag</span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">p</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">p</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">t</span><span class=\"mtk17\">&gt;</span><span class=\"mtk1\">this is for textrun</span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">t</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">p</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">p</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">img</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">src</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;base64....&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">width</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk7\">200</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">height</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk7\">200</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">href</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">src</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;http://localhost:8080&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk12\">label</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk8\">&quot;image n links label&quot;</span><span class=\"mtk4\">}</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">p</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">Component</span><span class=\"mtk1\"> </span><span class=\"mtk12\">text</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;can try componets in this way of course, like react!&quot;</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">Component</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">section</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">).</span><span class=\"mtk11\">then</span><span class=\"mtk1\">((</span><span class=\"mtk12\">doc</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">doc</span><span class=\"mtk1\">));</span></span></code></pre>\n<p>Also, you can checkout  <code>react-pdf</code> and <code>redocx</code> for a similar purpose.</p>\n<p>Can visit this <a href=\"https://github.com/chentsulin/awesome-react-renderer\" title=\"Github Repo\">Github Repo</a> for a curated list of react renderers.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n</style>","frontmatter":{"title":"React renderers, react everywhere?","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"June 23, 2021","updated_date":null,"tags":["JavaScript","React","Renderer"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/3e300a00ec9a7919e0e181600a6fc755/ee604/react.png","srcSet":"/static/3e300a00ec9a7919e0e181600a6fc755/69585/react.png 200w,\n/static/3e300a00ec9a7919e0e181600a6fc755/497c6/react.png 400w,\n/static/3e300a00ec9a7919e0e181600a6fc755/ee604/react.png 800w,\n/static/3e300a00ec9a7919e0e181600a6fc755/f3583/react.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/react-renderer/"}}},{"node":{"id":"50d1d230-39f5-5a37-a507-89d54b49acda","html":"<p>Everyone wants their application so fast, but how to achieve that, in that case, <strong>code splitting</strong> comes into the picture, where we split code and set the priority loading of the code snippet.</p>\n<p>But how do we set the priority or load them whenever required?</p>\n<h2 id=\"1-reactlazy\" style=\"position:relative;\"><a href=\"#1-reactlazy\" aria-label=\"1 reactlazy 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>1. React.lazy()</h2>\n<p>Using this we can set code priority to the lower or it will load only whenever required. So how to do that? it's easy, let's understand through an example.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\"> </span><span class=\"mtk3\">//generally approach to import Component</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\"> </span><span class=\"mtk15\">import</span><span class=\"mtk1\"> </span><span class=\"mtk12\">Blog</span><span class=\"mtk1\"> </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&#39;./BlogComponent&#39;</span><span class=\"mtk1\">;</span></span></code></pre>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">// This component is loaded dynamically or lazy load</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">BlogComponent</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">React</span><span class=\"mtk1\">.</span><span class=\"mtk11\">lazy</span><span class=\"mtk1\">(() </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk4\">import</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;./BlogComponent&#39;</span><span class=\"mtk1\">));</span></span></code></pre>\n<h2 id=\"2-reactsuspense\" style=\"position:relative;\"><a href=\"#2-reactsuspense\" aria-label=\"2 reactsuspense 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>2. React.Suspense()</h2>\n<p>Once the component is set for a lazy load then we need to set some kind of fallback option as well, till that code is rendered. This fallback option either could be a loader icon, screen, image, etc.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"js\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk3\">// This component is loaded dynamically or lazy load</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">BlogComponent</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">React</span><span class=\"mtk1\">.</span><span class=\"mtk11\">lazy</span><span class=\"mtk1\">(() </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk4\">import</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&#39;./BlogComponent&#39;</span><span class=\"mtk1\">));</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">AppComponent</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">return</span><span class=\"mtk1\"> (</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk3\">// Displays &lt;LoaderSpinner&gt; until BlogComponent loads</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">React.Suspense</span><span class=\"mtk1\"> </span><span class=\"mtk12\">fallback</span><span class=\"mtk1\">=</span><span class=\"mtk4\">{</span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">LoaderSpinner</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span><span class=\"mtk4\">}</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk17\">&lt;</span><span class=\"mtk10\">BlogComponent</span><span class=\"mtk1\"> </span><span class=\"mtk17\">/&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk4\">div</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk17\">&lt;/</span><span class=\"mtk10\">React.Suspense</span><span class=\"mtk17\">&gt;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  );</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk17 { color: #808080; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n</style>","frontmatter":{"title":"Code spliting in React via lazy and suspense","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"May 13, 2021","updated_date":null,"tags":["React"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/12ea532cdd9f0017a02bfb74d888bba7/ee604/react.png","srcSet":"/static/12ea532cdd9f0017a02bfb74d888bba7/69585/react.png 200w,\n/static/12ea532cdd9f0017a02bfb74d888bba7/497c6/react.png 400w,\n/static/12ea532cdd9f0017a02bfb74d888bba7/ee604/react.png 800w,\n/static/12ea532cdd9f0017a02bfb74d888bba7/f3583/react.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/react-code-splitting-with-lazy-suspense/"}}},{"node":{"id":"efdddb7e-36bc-564c-b3e8-7f39a6811ca5","html":"<p><a href=\"https://recoiljs.org/\" title=\"Recoil js\">Recoil js</a> is another state management library for React.</p>\n<p>Though we already have Redux. Mobx, Context, but here we got a new light entry in the community.</p>\n<p>Why I am saying <code>light</code> you will figure it out at the end of this blog.</p>\n<h2 id=\"why-recoil\" style=\"position:relative;\"><a href=\"#why-recoil\" aria-label=\"why recoil 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>Why Recoil</h2>\n<ul>\n<li>Firstly, it solves the global state management problems.</li>\n<li>Easy to learn; there are no new major principles n logic to learn.</li>\n<li>Quite Simple, it is similar like react.</li>\n<li>Though I like redux, but it will not take that much time to learn.</li>\n</ul>\n<h2 id=\"recoil--concepts\" style=\"position:relative;\"><a href=\"#recoil--concepts\" aria-label=\"recoil  concepts 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>Recoil  concepts</h2>\n<p>There are two major concepts:</p>\n<ol>\n<li><strong>Atoms</strong> </li>\n<li><strong>Selectors</strong></li>\n</ol>\n<p>Something new? Don't worry will understand this quickly.</p>\n<h3 id=\"atoms\" style=\"position:relative;\"><a href=\"#atoms\" aria-label=\"atoms 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>Atoms</h3>\n<p> This is similar to how we use the <code>useState</code> hook in react. If you are new to react hooks, checkout <a href=\"https://www.loginradius.com/blog/engineering/react-hooks-guide/\" title=\"react hooks guide\">react hooks guide</a>.</p>\n<p> e.g.:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"> const [age, setAge] = useState(0);</span></code></pre>\n<p><strong>age</strong> : this will be used for state variable declaration.\n<strong>setAge</strong> :this will be used for state variable updations.</p>\n<h4 id=\"1-lets-start-with-binding-root-app-with-recoil\" style=\"position:relative;\"><a href=\"#1-lets-start-with-binding-root-app-with-recoil\" aria-label=\"1 lets start with binding root app with recoil 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>1. Let's start with binding root app with Recoil</h4>\n<p>Now you need to make a few alterations in your app's root level, like the below snippet.</p>\n<p><code>RecoilRoot</code> will behave like a global context provider that will share the global state to your app tree.</p>\n<p>Now update your older code snippet.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">ReactDOM.render( &lt;AppPage /&gt;, document.getElementById(&quot;root&quot;))</span></code></pre>\n<p>to </p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">import { RecoilRoot } from &quot;recoil&quot;;</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">ReactDOM.render( </span>\n<span class=\"grvsc-line\"> &lt;RecoilRoot&gt;</span>\n<span class=\"grvsc-line\">    &lt;AppPage /&gt;</span>\n<span class=\"grvsc-line\"> &lt;/RecoilRoot&gt;, document.getElementById(&quot;root&quot;))</span></code></pre>\n<h4 id=\"2-set-the-atom\" style=\"position:relative;\"><a href=\"#2-set-the-atom\" aria-label=\"2 set the atom 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>2. Set the Atom</h4>\n<p>Recoil calls this part as <strong>atom</strong>, where we set the global key, value.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">import { atom } from &quot;recoil&quot;;</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">const age = atom({</span>\n<span class=\"grvsc-line\">  key: &quot;age&quot;, </span>\n<span class=\"grvsc-line\">  default: 0  // default global value for age key</span>\n<span class=\"grvsc-line\">});</span></code></pre>\n<p>Now this atom will be accessible throughout the app.</p>\n<h4 id=\"3-use-the-atom\" style=\"position:relative;\"><a href=\"#3-use-the-atom\" aria-label=\"3 use the atom 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>3. use the atom</h4>\n<p>Now update your older code snippet.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"> const [age, setAge] = useState(0);</span></code></pre>\n<p>to </p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">import { useRecoilState } from &#39;recoil&#39;</span>\n<span class=\"grvsc-line\">const [ageState, setAge] = useRecoilState(age);</span></code></pre>\n<p>For a Larger view, here is <strong>Full Code</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">import { atom,useRecoilState } from &#39;recoil&#39;</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">const age = atom({</span>\n<span class=\"grvsc-line\">  key: &quot;age&quot;, </span>\n<span class=\"grvsc-line\">  default: 0  // default global value for age key</span>\n<span class=\"grvsc-line\">});</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">export const AgeCalculator = () =&gt; {</span>\n<span class=\"grvsc-line\">const [ageState, setAge] = useRecoilState(age);</span>\n<span class=\"grvsc-line\">}</span></code></pre>\n<p>Quite easy. Isn't it?\nNow let's move to another part <strong>selectors</strong>.</p>\n<h3 id=\"selectors\" style=\"position:relative;\"><a href=\"#selectors\" aria-label=\"selectors 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>Selectors</h3>\n<p>This is similar to how Redux manages states.</p>\n<p>if a value can be derived/computed from the state, then we can skip re initialize of an another separate state key, for that use selectors.</p>\n<h4 id=\"1-set-the-selectors\" style=\"position:relative;\"><a href=\"#1-set-the-selectors\" aria-label=\"1 set the selectors 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>1. set the selectors</h4>\n<p>In the below example, we are getting <code>isChild</code> value from <code>age</code> key, then we can directly use <strong>selector</strong> instead of adding a new key or <strong>atom</strong>.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">import {selector} from &#39;recoil&#39;</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">const isChild = selector({</span>\n<span class=\"grvsc-line\">  key: &quot;childage&quot;,</span>\n<span class=\"grvsc-line\">  get: ({ get }) =&gt; {</span>\n<span class=\"grvsc-line\">    const state = get(age);</span>\n<span class=\"grvsc-line\">    return state &lt; 10 ;</span>\n<span class=\"grvsc-line\">  }</span>\n<span class=\"grvsc-line\">});</span></code></pre>\n<h4 id=\"2-use-the-selectors\" style=\"position:relative;\"><a href=\"#2-use-the-selectors\" aria-label=\"2 use the selectors 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>2. use the selectors</h4>\n<p>Now will use the above-mentioned selector.</p>\n<p>below code snippet use <code>age</code> value to <code>isChild</code>.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">  const [ageState, setAge] = useRecoilState(age);</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">  const value = useRecoilValue(isChild);</span></code></pre>\n<p>For a larger view, here is <strong>Full Code</strong></p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"9\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">import {selector, useRecoilState} from &#39;recoil&#39; </span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">const isChild = selector({</span>\n<span class=\"grvsc-line\">  key: &quot;childage&quot;,</span>\n<span class=\"grvsc-line\">  get: ({ get }) =&gt; {</span>\n<span class=\"grvsc-line\">    const state = get(age);</span>\n<span class=\"grvsc-line\">    return state &lt; 10 ;</span>\n<span class=\"grvsc-line\">  }</span>\n<span class=\"grvsc-line\">});</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">export const AgeCalculator = () =&gt; {</span>\n<span class=\"grvsc-line\">    const [ageState, setAge] = useRecoilState(age);</span>\n<span class=\"grvsc-line\">   const value = useRecoilValue(isChild);</span>\n<span class=\"grvsc-line\">}</span></code></pre>\n<p>That's all, Milord.</p>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion 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>Conclusion</h2>\n<p>I hope you got why I am saying this as <strong><code>light</code></strong>.</p>\n<p>Recoil is looking relatively easy, promising, and early-stage, but again this is the next generation, and it will take time to get the own space in the <a href=\"https://community.loginradius.com/\">community</a>.  </p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n</style>","frontmatter":{"title":"What is recoil.js and how it is managing in react?","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"April 30, 2021","updated_date":null,"tags":["JavaScript","React","Recoil"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/f37a15f3f8cda8461c5455bdd2895e0c/ee604/react.png","srcSet":"/static/f37a15f3f8cda8461c5455bdd2895e0c/69585/react.png 200w,\n/static/f37a15f3f8cda8461c5455bdd2895e0c/497c6/react.png 400w,\n/static/f37a15f3f8cda8461c5455bdd2895e0c/ee604/react.png 800w,\n/static/f37a15f3f8cda8461c5455bdd2895e0c/f3583/react.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/recoiling-the-react/"}}},{"node":{"id":"43de49ea-9c68-55fd-b5cc-3cb805cb98f5","html":"<h1 id=\"how-git-local-repository-works\" style=\"position:relative;\"><a href=\"#how-git-local-repository-works\" aria-label=\"how git local repository works 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>How Git Local Repository Works</h1>\n<p>Let's understand how git set up a local repository\nOnce we initialize or clone any git project that will set up a local project environment.</p>\n<p>that whole environment will look like the below picture </p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 46.61538461538461%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAABJ0AAASdAHeZh94AAABnklEQVQoz3VR2U7CUBDt/z/y6hLjm0+GJ6wLCSpiBRUpbSmllS6E0gKBQEopy/HOmEbjMsn03s6dOTPnjARhs9kMYThCHMUYj8fYZBn2+z0mkwniOBYecU6e+/zcQKv1Bk3ToKoqDMOAaZrIRJ1ESW3x8O50EEUhjI6JvuthMBigUX8SZ4Buz4ZSbyBJM1zflFE8P4OhqwL4BS+vTXRMC7Is8zAMqGk6LKsDP/DxprYZoN93Ua1WMRwO4fk+nup1npAAHNsULFaIBUC6zrBI1qg9Kl+ARE3TdVQqt/B9D+s05fEJrPpQw2uzyXdm01Zh2w4WiwW+2+3dvZAsgrTdbvGX/RdXFAWFQgHlsqBeLKJUKkG+vMLB4RGm0ymk3W73q4him82GQWk5dOYNwjCELtgEQYDjk1OULmTW3exanCvRJ0kSjEYjpjWfz7mQ4lREG+z1etydjJZlWZaQxueNe57HGruuK4bIPgFToRkJSr5cLhmMpqR7Pg3951NSU2riODZ8AZjH6WRA8p/6UYwWs1qtmAHFCDT3vO67JHT/ADhMn7ej6wRWAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"git-local-environment\"\n        title=\"git-local-environment\"\n        src=\"/static/808664775730f7970482cfbf83f9c1cf/e5715/localrepository.png\"\n        srcset=\"/static/808664775730f7970482cfbf83f9c1cf/a6d36/localrepository.png 650w,\n/static/808664775730f7970482cfbf83f9c1cf/e5715/localrepository.png 768w,\n/static/808664775730f7970482cfbf83f9c1cf/21482/localrepository.png 1350w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p><strong>Project Folder</strong>: The main folder consists of a workspace and local repository</p>\n<p><strong>Work Directory</strong>: Inside Project Folder where we actually work,  we keep all files and perform many operations like addition, update, deletion of files</p>\n<p><strong>Local Repository</strong>: Here we don't actually change anything, this is handled automatically by git. this consists <strong>staging area</strong>, <strong>commit history</strong>, <strong>stash area</strong> etc.</p>\n<p>Let's get into it step by step and see how we perform command or action and behind the scene, git do its own activity. </p>\n<ul>\n<li>\n<p>Step 1. Git clone and project:\n<span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 15.846153846153847%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAr0lEQVQI13WNzQqCQBSFpxH8Q30e8Zl7gSDcRAQludFooh+FzBlBzFwUqJzwrtp04PAt7uU7zDAM2LYN0zRhWRaR8xkYY9A0jRgEAbquQ5IkqKoKQgiUpUSeZyjuJR6Fgjie0DwbsEngeR7VdV04jkNSXddp4FcYRRHqukaapsTbNcNmt8Q2XmC1DtG2r+mf4V8550Tf9zGOI5RSmCKlxDD0+Lx7HC4h9mKOcxbT7Qu2WI87LgIs9gAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"3\"\n        title=\"3\"\n        src=\"/static/1459d0fecf44f2077b4495fe7e2c9d30/e5715/3.png\"\n        srcset=\"/static/1459d0fecf44f2077b4495fe7e2c9d30/a6d36/3.png 650w,\n/static/1459d0fecf44f2077b4495fe7e2c9d30/e5715/3.png 768w,\n/static/1459d0fecf44f2077b4495fe7e2c9d30/d76ab/3.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 15.692307692307693%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAA1ElEQVQI1x2OO0vDYABFQ6ZAQkoeEjLksQSyJ/nfDi4+QLTaUHUQadRKoi1tWiyt/aKbCkfz3eUMF869iq7ruK6LbdtYliVpGAaaptF3iqKQ5zlCCKrqkY/dJ009Y7sRLBdr2uWaVfvO9PmFvdijeJ5HmqYkSUIcx/i+Lwccx/nngRQXRUEnOsY3I6r6nMvykKdmyN3DKeXtCeP7I4bXZ3TdF0r/KIoiwjAkCAIpGgwGmKYpn6qqSpZl/Hz/0q5mLHZXUlC3F8w3JdO3EZPmmNf5hD5/O9qQ15OmR9IAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"4\"\n        title=\"4\"\n        src=\"/static/37b235ac7bc6675864fd990467100e91/e5715/4.png\"\n        srcset=\"/static/37b235ac7bc6675864fd990467100e91/a6d36/4.png 650w,\n/static/37b235ac7bc6675864fd990467100e91/e5715/4.png 768w,\n/static/37b235ac7bc6675864fd990467100e91/d76ab/4.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n</li>\n<li>\n<p>Step 2. Explore what we got in repository\n<span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 15.692307692307693%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAoUlEQVQI11XOwQqEIBDGcfEU2aGsoEPUpWB7gqDe/2067LqwLjXjt6OHYMEfOIJ/VWVZwtY1qqq65XmOLMtgjIFSCuu6wnsPZkYI4Z+cEdE9q2ma8FgWzPOMcRzRdR1qeSBqmiaF933HcRxw7g3ieBE4L8Lz5fDx3+QiTlTf9xiGIcXivm1bWGtRFEWitca2bRJzuCTCEpQlggRIfsdJnKMffWycLAkZZicAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"5\"\n        title=\"5\"\n        src=\"/static/d106fd3e9c47d03c8e312c37f384b074/e5715/5.png\"\n        srcset=\"/static/d106fd3e9c47d03c8e312c37f384b074/a6d36/5.png 650w,\n/static/d106fd3e9c47d03c8e312c37f384b074/e5715/5.png 768w,\n/static/d106fd3e9c47d03c8e312c37f384b074/d76ab/5.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 15.692307692307693%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAwklEQVQI10WOS06EQBRFWQODaiE0XeEX23WInwU7cwuSGJsBabBDiYYWIgMnBFIeKQb6kpN7cwY3zwrDkDiOiaJoISYIAuROst367JYUYkOapqi65r1u+DyfKcuSruuoF9c0DafTK0op5nnG8n1/HUyShMv9FVJKjDOYLoTg/vaO5+KFh6dH1McbhzxnGAayLKOqKoqiWLvWGstxHP65wHXdPzzPw7Ztbq5T+u8v8vaI/tG0bYs58+U4jkzTRN/3q/sFhQ6YnhhHlOcAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"6\"\n        title=\"6\"\n        src=\"/static/55598410756c12990d2e729cbeb96f1a/e5715/6.png\"\n        srcset=\"/static/55598410756c12990d2e729cbeb96f1a/a6d36/6.png 650w,\n/static/55598410756c12990d2e729cbeb96f1a/e5715/6.png 768w,\n/static/55598410756c12990d2e729cbeb96f1a/d76ab/6.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n</li>\n<li>\n<p>Step 3. Do some modification in a files\n<span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 15.692307692307693%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAtElEQVQI11WOXQqCUBCFXYVP/iHWvfvQNl076EEoijC0umZhaUhvosmXtwehgY85HJhzxhBCIKVEzAVaz8ft+z6e5+G6LqZpEoYh6qIo8oLn40GaplRVhVKjVxSczyfyPKfvewzHcQiCADkihCSYzbBta8SeAhdhxOawZbleoe5Xdvs9TdMQxzFZlpEkyU8Pw4ChDy3L+kOXaKbAaEH9fpHcjnwYKMsSPfrLtm3puo66rn/eF8J9mRdGK9PhAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"7\"\n        title=\"7\"\n        src=\"/static/2f5ff2c421ac7c4ff9314589c4e38e90/e5715/7.png\"\n        srcset=\"/static/2f5ff2c421ac7c4ff9314589c4e38e90/a6d36/7.png 650w,\n/static/2f5ff2c421ac7c4ff9314589c4e38e90/e5715/7.png 768w,\n/static/2f5ff2c421ac7c4ff9314589c4e38e90/d76ab/7.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 16%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAx0lEQVQI1zWOwWqDQBCGFz2IiNUVbFEamqdID8mLlz5BL16aHLZow5ptMVXqoRfRytc1NAMf888MDJ+I4xhpuQlDwn+CIMDzPHzfRwjB5nHDqa4x2vB1PlOWJW3borXGGMPx+E5t79M0IR7WaxbuVyvyPCfLMtI0RcqYKIpwXZfddser2vP08oz+PLE/HOj7nqIoqKoKpdQlz/OMWOzukoRbKZGRtbU9sfMVx3Hswy3fPz3q441fZpqmYanFchgGxnGk67rL7g99A5PnN20uggAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"8\"\n        title=\"8\"\n        src=\"/static/a607dc975797d42a0ab7233510330102/e5715/8.png\"\n        srcset=\"/static/a607dc975797d42a0ab7233510330102/a6d36/8.png 650w,\n/static/a607dc975797d42a0ab7233510330102/e5715/8.png 768w,\n/static/a607dc975797d42a0ab7233510330102/d76ab/8.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n</li>\n<li>\n<p>Step 4. Add this file in to staging (ready for commit)\n<span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 16.153846153846153%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAnUlEQVQI13WOsQ6CMBCGSxghlPch6iqv6uZbODlAaEJbY0KgOzAB6qdtHPWSL5e75P/uhJSSPM8D0vOZPVmWkSQJQgiKosAag2kNbhhomoa+70O31lLXNUoplmVBpGnKP7w0jmMOuz1tZzhdzujOorUOYS90zjF8j/gKQv/JL7wwiiLKY8nj9eR6q6juinEcQ3iaJtZ1Zds25nkOuzdyq5IiSDbhowAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"9\"\n        title=\"9\"\n        src=\"/static/9e0c5445d8afb14f821d3faae048e1be/e5715/9.png\"\n        srcset=\"/static/9e0c5445d8afb14f821d3faae048e1be/a6d36/9.png 650w,\n/static/9e0c5445d8afb14f821d3faae048e1be/e5715/9.png 768w,\n/static/9e0c5445d8afb14f821d3faae048e1be/d76ab/9.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 16.153846153846153%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAArklEQVQI12XMTQuCQBSF4WkscsyV/RNx7/+H6MscMqVc6LQWCVKht2loEXThchb33Eeso4goWhOGIUEQoJTC8zyEEEgpXSZJQlleKIoC0xrO+kzTNOR5TlVVZFmG1pphGBBLf4kKFf7KR3qSxXzhkF8wjmMLtWz3O25tzVbv7PNowRPGGFp7++CfEe55Zld+U4g/ME1TVy7ris31wOZ+5PF60nUd4zgyTRN937vOG0lZj3sVzwZzAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"10\"\n        title=\"10\"\n        src=\"/static/cbefe1b9c76ef7554c405ccaec0ac44c/e5715/10.png\"\n        srcset=\"/static/cbefe1b9c76ef7554c405ccaec0ac44c/a6d36/10.png 650w,\n/static/cbefe1b9c76ef7554c405ccaec0ac44c/e5715/10.png 768w,\n/static/cbefe1b9c76ef7554c405ccaec0ac44c/d76ab/10.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n</li>\n<li>\n<p>Step 5. Commit the file\n<span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 16.153846153846153%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAo0lEQVQI13WMwQqCQABExUOBCOqXeDW/PQgiCDtm6ppEkBYpdTAFsTVerdDRgccwc3iaZVk4jjNi2zZq/1HfbD5j4fukaYoQgvxyIRNHntUDkQiyLOMQhsRxTN/3aIZhMIVpmui6jud55HlOEifUr5plsGK937IONpT3kqIoiKIIFe0XplAy1a7r0nUdbdPyRrI57xD3E9fqxmcYkFLSNM0o/AITQpBCIUmmJgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"11\"\n        title=\"11\"\n        src=\"/static/715e8bc5eaacf7162c1b1150d4efbae0/e5715/11.png\"\n        srcset=\"/static/715e8bc5eaacf7162c1b1150d4efbae0/a6d36/11.png 650w,\n/static/715e8bc5eaacf7162c1b1150d4efbae0/e5715/11.png 768w,\n/static/715e8bc5eaacf7162c1b1150d4efbae0/d76ab/11.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 16.153846153846153%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAtklEQVQI112Mu4qDUABEfYCNitj4+Atb/fJA2hBCZCtXcw1WGrnk1WiICBvOxkuqDByYYZjRgiAgimOiKGLxC57nKXzfx7IssiyjrmuEELRty+EguF6uHMWRpmkoioKqqpjnGS0MQ+L3Yfw5XbLjONi2jeu6GIZBmqZ0XadGj/HB/idn95uz2q6RUtL3PWVZskh7i290XVeYpqlykiRM08QwDGp0kj3yfmbT5pyfN15/L8ZxVN0/A0SRqFQoLAcAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"12\"\n        title=\"12\"\n        src=\"/static/129b4e7311b370cefbf9df51f1442c7d/e5715/12.png\"\n        srcset=\"/static/129b4e7311b370cefbf9df51f1442c7d/a6d36/12.png 650w,\n/static/129b4e7311b370cefbf9df51f1442c7d/e5715/12.png 768w,\n/static/129b4e7311b370cefbf9df51f1442c7d/d76ab/12.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n</li>\n<li>\n<p>Step 6. Push the changes\n<span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 16.153846153846153%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAo0lEQVQI13WOzQqCQACEV7wp/jyKhwQfuy4+QRGditDd9VSpUBEk6UG2Dl+uh24NfAwMzDAiDEPiOJ6JouiH53n4vo/jOCzSlKrSaK2p65qylLRti5aay+k8uUJKiTEGYUv/CIIA13XJsoymaVBK0fevabziY95sDzuW65zVJqcoC6yEffAPOyaEIEkSxnFkGIa59Oy62ff3guNVc+se9EM/Z1/jhZACptMEmgAAAABJRU5ErkJggg=='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"13\"\n        title=\"13\"\n        src=\"/static/fad4d60001ffd8adcf4485daad7cfd9e/e5715/13.png\"\n        srcset=\"/static/fad4d60001ffd8adcf4485daad7cfd9e/a6d36/13.png 650w,\n/static/fad4d60001ffd8adcf4485daad7cfd9e/e5715/13.png 768w,\n/static/fad4d60001ffd8adcf4485daad7cfd9e/d76ab/13.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 768px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 16.153846153846153%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAADCAYAAACTWi8uAAAACXBIWXMAABJ0AAASdAHeZh94AAAAxklEQVQI1yWOTWuDQBRFB0QRFQQ/sFm7UZcV/3V32fQHZJtSkqrjojQYIaGlEXSj3ZxMpg8uBy7cxxFJkvC02fBgFEWEYUgQBLiui+s4CCF4Lku6rkNKSd/31HXNMAw0iqevE10jaZuWdV0RRVGQ5zlZlpGmKXEc6/i+r2MYBlVVMZzPNG3LNE36+Z8aH44HtrtXXnZb3j7eeZxwlIXnef9GKpZlYZqmpm3b2rBUhsuyMM+zHo3jqHkbb1x/v5E/n+wvR93dAWwlksDbUfdlAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"14\"\n        title=\"14\"\n        src=\"/static/ed2244f3d6a9668946ee6cfc78d5ef6f/e5715/14.png\"\n        srcset=\"/static/ed2244f3d6a9668946ee6cfc78d5ef6f/a6d36/14.png 650w,\n/static/ed2244f3d6a9668946ee6cfc78d5ef6f/e5715/14.png 768w,\n/static/ed2244f3d6a9668946ee6cfc78d5ef6f/d76ab/14.png 1731w\"\n        sizes=\"(max-width: 768px) 100vw, 768px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n</li>\n</ul>\n<p>Hope this makes clear how git handling things at the local repository.</p>\n<blockquote>\n<p>Note: <a href=\"https://compile7.org/decompile/how-to-automate-workflows-with-git-hooks/\">Click here to learn how you can automate your Git workflows with Hooks</a></p>\n</blockquote>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"How Git Local Repository Works","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"April 12, 2021","updated_date":null,"tags":["GIT"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/326443284e0af982c65082fa6f3a393d/ee604/git.png","srcSet":"/static/326443284e0af982c65082fa6f3a393d/69585/git.png 200w,\n/static/326443284e0af982c65082fa6f3a393d/497c6/git.png 400w,\n/static/326443284e0af982c65082fa6f3a393d/ee604/git.png 800w,\n/static/326443284e0af982c65082fa6f3a393d/f3583/git.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/how-git-local-repository-works/"}}},{"node":{"id":"3e95ca78-ccba-5c81-9771-92395b67748e","html":"<p>Git is an important part of daily programming and is commonly used in the software industry. Since you can use a lot of different commands, mastering Git needs time. But some commands are more commonly used. So I'm going to share the most useful Git commands in this post that every developer should know.</p>\n<p>But first you need to know the <a href=\"https://www.loginradius.com/blog/engineering/github-api/\">fundamentals of Git</a> to understand this article.</p>\n<h1 id=\"useful-git-commands-list\" style=\"position:relative;\"><a href=\"#useful-git-commands-list\" aria-label=\"useful git commands list 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>Useful Git Commands List</h1>\n<table>\n<thead>\n<tr>\n<th>Command</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><code>git init</code></td>\n<td>Initialize a local Git repository</td>\n</tr>\n<tr>\n<td><code>git clone repo_url</code></td>\n<td>Clone public repository</td>\n</tr>\n<tr>\n<td><code>git clone ssh://git@github.com/[username]/[repository-name].git</code></td>\n<td>Clone private repository</td>\n</tr>\n<tr>\n<td><code>git status</code></td>\n<td>Check status</td>\n</tr>\n<tr>\n<td><code>git add [file-name]</code></td>\n<td>Add a file to the staging area</td>\n</tr>\n<tr>\n<td><code>git add -A</code></td>\n<td>Add all new and changed files to the staging area</td>\n</tr>\n<tr>\n<td><code>git commit -m \"[commit message]\"</code></td>\n<td>Commit changes</td>\n</tr>\n<tr>\n<td><code>git rm -r [file-name.txt]</code></td>\n<td>Remove a file (or folder)</td>\n</tr>\n<tr>\n<td><code>git branch</code></td>\n<td>List of branches (the asterisk denotes the current branch)</td>\n</tr>\n<tr>\n<td><code>git branch -a</code></td>\n<td>List all branches (local and remote)</td>\n</tr>\n<tr>\n<td><code>git branch [branch name]</code></td>\n<td>Create a new branch</td>\n</tr>\n<tr>\n<td><code>git branch -d [branch name]</code></td>\n<td>Delete a branch</td>\n</tr>\n<tr>\n<td><code>git branch -D [branch name]</code></td>\n<td>Delete a branch forcefully</td>\n</tr>\n<tr>\n<td><code>git push origin --delete [branch name]</code></td>\n<td>Delete a remote branch</td>\n</tr>\n<tr>\n<td><code>git checkout -b [branch name]</code></td>\n<td>Create a new branch and switch to it</td>\n</tr>\n<tr>\n<td><code>git checkout -b [branch name] origin/[branch name]</code></td>\n<td>Clone a remote branch and switch to it</td>\n</tr>\n<tr>\n<td><code>git branch -m [old branch name] [new branch name]</code></td>\n<td>Rename a local branch</td>\n</tr>\n<tr>\n<td><code>git checkout [branch name]</code></td>\n<td>Switch to a branch</td>\n</tr>\n<tr>\n<td><code>git checkout -</code></td>\n<td>Switch to the branch last checked out</td>\n</tr>\n<tr>\n<td><code>git checkout -- [file-name.txt]</code></td>\n<td>Discard changes to a file</td>\n</tr>\n<tr>\n<td><code>git merge [branch name]</code></td>\n<td>Merge a branch into the active branch</td>\n</tr>\n<tr>\n<td><code>git merge [source branch] [target branch]</code></td>\n<td>Merge a branch into a target branch</td>\n</tr>\n<tr>\n<td><code>git stash</code></td>\n<td>Stash changes in a dirty working directory</td>\n</tr>\n<tr>\n<td><code>git stash clear</code></td>\n<td>Remove all stashed entries</td>\n</tr>\n<tr>\n<td><code>git push origin [branch name]</code></td>\n<td>Push a branch to your remote repository</td>\n</tr>\n<tr>\n<td><code>git push -u origin [branch name]</code></td>\n<td>Push changes to remote repository (and remember the branch)</td>\n</tr>\n<tr>\n<td><code>git push</code></td>\n<td>Push changes to remote repository (remembered branch)</td>\n</tr>\n<tr>\n<td><code>git push origin --delete [branch name]</code></td>\n<td>Delete a remote branch</td>\n</tr>\n<tr>\n<td><code>git pull</code></td>\n<td>Update local repository to the newest commit</td>\n</tr>\n<tr>\n<td><code>git pull origin [branch name]</code></td>\n<td>Pull changes from remote repository</td>\n</tr>\n<tr>\n<td><code>git remote add origin ssh://git@github.com/[username]/[repository-name].git</code></td>\n<td>Add a remote repository</td>\n</tr>\n<tr>\n<td><code>git remote set-url origin ssh://git@github.com/[username]/[repository-name].git</code></td>\n<td>Set a repository's origin branch to SSH</td>\n</tr>\n<tr>\n<td><code>git log</code></td>\n<td>View changes</td>\n</tr>\n<tr>\n<td><code>git log --summary</code></td>\n<td>View changes (detailed)</td>\n</tr>\n<tr>\n<td><code>git log --oneline</code></td>\n<td>View changes (briefly)</td>\n</tr>\n<tr>\n<td><code>git diff [source branch] [target branch]</code></td>\n<td>Preview changes before merging</td>\n</tr>\n<tr>\n<td><code>git revert commitid</code></td>\n<td>Revert commit changes</td>\n</tr>\n<tr>\n<td><code>git config --global user.name \"your_username\"</code></td>\n<td>Set globally Username</td>\n</tr>\n<tr>\n<td><code>git config --global user.email \"your_email_address@example.com\"</code></td>\n<td>Set globally Email id</td>\n</tr>\n<tr>\n<td><code>git config --global --list</code></td>\n<td>Get global config</td>\n</tr>\n</tbody>\n</table>\n<p>So these are the most helpful git commands I find in my everyday programming. There are several more things to learn about Git, I will explain them in a separate post.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"35+ Git Commands List Every Programmer Should Know","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"February 17, 2021","updated_date":null,"tags":["GIT"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/dcc4ef7c6f6e2161d168898cf518845d/ee604/git.png","srcSet":"/static/dcc4ef7c6f6e2161d168898cf518845d/69585/git.png 200w,\n/static/dcc4ef7c6f6e2161d168898cf518845d/497c6/git.png 400w,\n/static/dcc4ef7c6f6e2161d168898cf518845d/ee604/git.png 800w,\n/static/dcc4ef7c6f6e2161d168898cf518845d/f3583/git.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/git-commands/"}}},{"node":{"id":"3a33f6f5-df0c-55f0-8d4e-c898e2a8cd12","html":"<p>Many of us have to choose between Merge and Rebase as a Developer. Here I'll explain what merge and rebase are, why you should use them, and how to do so.</p>\n<p>The same function is fulfilled by Git Merge and Git Rebase. They are built to incorporate adjustments into one from different divisions. Although the end objective is the same, it is done in various ways by those two approaches, and it is useful to know the difference as you become a better developer of software.</p>\n<h2 id=\"what-are-git-merge-and-git-rebase\" style=\"position:relative;\"><a href=\"#what-are-git-merge-and-git-rebase\" aria-label=\"what are git merge and git rebase 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>What are Git Merge and Git Rebase?</h2>\n<p><em>Git Merge and Git Rebase are both used to combine the changes of branches but in a distinct way.</em></p>\n<p><strong>Git Merge</strong> - For developers using version control systems, merging is a prevalent method. Merging takes the contents of a source branch and combines them with a target branch, to be more precise. Only the <a href=\"https://medium.com/@loginradius/how-to-fetch-a-remote-branch-using-git-5c0f6d28264d\">target branch is updated</a> in this process. The history of the source branch remains similar.</p>\n<p><strong>Git Rebase</strong> - Another way to integrate modifications from one branch to another is by Rebase. Rebase compresses all the modifications into a single patch. The patch is then inserted into the target branch.</p>\n<h3 id=\"git-merge\" style=\"position:relative;\"><a href=\"#git-merge\" aria-label=\"git merge 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 Merge</h3>\n<p>Combine multiple branch histories together.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">  A---B---C feature</span>\n<span class=\"grvsc-line\"> /</span>\n<span class=\"grvsc-line\">D---E---F---G master </span></code></pre>\n<p>if we are merging feature and master branch, then it would be</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">  A---B---C feature</span>\n<span class=\"grvsc-line\"> /               \\</span>\n<span class=\"grvsc-line\">D---E---F---G---H master</span></code></pre>\n<p><strong>Commands</strong> for merging feature and master branch</p>\n<p><code>git checkout feature</code>\n<code>git merge master</code></p>\n<p><strong>Note:</strong></p>\n<ul>\n<li>merge executes only one new commit</li>\n<li>if the feature branch has a completely different development </li>\n<li>If you get conflict while merging\n<code>resolve conflicts</code>\n<code>git add (changes)</code>\n<code>git merge --continue</code></li>\n</ul>\n<h3 id=\"git-rebase\" style=\"position:relative;\"><a href=\"#git-rebase\" aria-label=\"git rebase 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 Rebase</h3>\n<p>Reapply commits on top of the base branch</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">   A---B---C feature</span>\n<span class=\"grvsc-line\"> /</span>\n<span class=\"grvsc-line\">D---E---F---G master</span></code></pre>\n<p>if we are rebasing the feature branch onto the master branch, then it would be</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">\t   A&#39;--B&#39;--C&#39; feature</span>\n<span class=\"grvsc-line\">\t /</span>\n<span class=\"grvsc-line\">\tD---E---F---G master</span></code></pre>\n<p><strong>Commands</strong> for merging feature and master branch</p>\n<p><code>git checkout feature</code>\n<code>git rebase master</code></p>\n<p><strong>Note:</strong> </p>\n<ul>\n<li>rebase typically executes multiple (number of commits in current branch).</li>\n<li>If you get conflict while rebasing\n<code>resolve conflicts</code>\n<code>git add (changes)</code>\n<code>git rebase --continue</code></li>\n</ul>\n<h2 id=\"when-to-use-git-rebase-or-git-merge\" style=\"position:relative;\"><a href=\"#when-to-use-git-rebase-or-git-merge\" aria-label=\"when to use git rebase or git merge 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>When to use Git Rebase or Git Merge</h2>\n<h3 id=\"choose-merge\" style=\"position:relative;\"><a href=\"#choose-merge\" aria-label=\"choose merge 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>Choose Merge</h3>\n<ul>\n<li>whenever we want to add changes of a feature branch back into the base branch.</li>\n<li>if you want to keep the same history rather than rewrite it.</li>\n<li>if you want to revert the changes quickly</li>\n</ul>\n<h3 id=\"choose-rebase\" style=\"position:relative;\"><a href=\"#choose-rebase\" aria-label=\"choose rebase 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>Choose Rebase</h3>\n<ul>\n<li>whenever we want to add changes of a base branch back to a feature branch.</li>\n<li>squash multiple commits</li>\n<li>reiterate each commit and update the changes</li>\n<li>reverting rebase would be very difficult</li>\n</ul>\n<h3 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion 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>Conclusion</h3>\n<p>I hope some perspectives on Git merge and Git rebase have been provided by this description. The strategy of merge vs rebase is still debatable. But maybe this article will help to dispel your doubts and encourage you to take an approach that works for your team. Here are few articles posted by me that will help you in learning few more things in Git:</p>\n<ol>\n<li><a href=\"https://www.loginradius.com/blog/engineering/git-cherry-pick/\">How to use Git Cherry Pick</a></li>\n<li><a href=\"https://www.loginradius.com/blog/engineering/git-pull-force/\">How to Perform a Git Force Pull</a></li>\n</ol>\n<p>Do comment on the subjects that you would like me to write about in the coming weeks :)</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n</style>","frontmatter":{"title":"Git merge vs. Git Rebase: What's the difference?","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"January 27, 2021","updated_date":null,"tags":["GIT"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/84d7585291c78a887f774814c64479d6/ee604/merge.png","srcSet":"/static/84d7585291c78a887f774814c64479d6/69585/merge.png 200w,\n/static/84d7585291c78a887f774814c64479d6/497c6/merge.png 400w,\n/static/84d7585291c78a887f774814c64479d6/ee604/merge.png 800w,\n/static/84d7585291c78a887f774814c64479d6/f3583/merge.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/git-rebase-vs-git-merge/"}}},{"node":{"id":"b6b7417c-1baa-5d47-8d97-0704d063a25d","html":"<p>It is fine when you and the rest of your team are working on different files. But sometimes, multiple people simultaneously work on the same files, and that's where the problems arise.</p>\n<p>Just a Note: <code>git pull = git fetch + git merge</code></p>\n<p>In this scenario, when you have local changes in your system and you pull the latest contribution, you got this error.</p>\n<p><code>error: your local changes to the following files would be overwritten by merge: readme.md</code>\n<code>please commit your changes or stash them before you merge.</code>\n<code>Aborting...</code></p>\n<h2 id=\"now-you-have-2-major-choices\" style=\"position:relative;\"><a href=\"#now-you-have-2-major-choices\" aria-label=\"now you have 2 major choices 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>Now you have 2 major choices</h2>\n<h3 id=\"choice-1-you-want-to-keep-local-changes\" style=\"position:relative;\"><a href=\"#choice-1-you-want-to-keep-local-changes\" aria-label=\"choice 1 you want to keep local changes 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>Choice 1: you want to keep local changes</h3>\n<p><code>git stash</code>  (stash the local changes clean the workspace)\n<code>git pull</code> (pull the latest changes from remote )\n<code>git stash apply</code> (apply the latest stash)</p>\n<p>-----------(or)---------------</p>\n<p><code>git fetch</code> (fetch the local machine folder)\n<code>git stash</code> (stash the local changes clean the workspace)\n<code>git merge '@{u}'</code> (merge the changes from local folder to workspace folder)\n<code>git stash pop</code> (apply the latest stash )</p>\n<p>By default, the stash changes will become staged. If you want to unstage them, use <code>git restore --staged</code> (git ver > 2.25.0).</p>\n<h3 id=\"choice-2-you-do-not-want-the-local-changes\" style=\"position:relative;\"><a href=\"#choice-2-you-do-not-want-the-local-changes\" aria-label=\"choice 2 you do not want the local changes 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>Choice 2: you do not want the local changes</h3>\n<p><code>git reset --hard HEAD</code> (reset to the head means remove all local changes)\n<code>git pull</code> (get the latest changes)</p>\n<p>-----------(or)---------------</p>\n<p><code>git fetch</code> (fetch the local machine folder)\n<code>git reset --hard HEAD</code> (reset to the head means remove all local changes)\n<code>git merge '@{u}'</code>  (merge the changes from the local folder to workspace folder)</p>\n<h2 id=\"git-pull---force\" style=\"position:relative;\"><a href=\"#git-pull---force\" aria-label=\"git pull   force 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 pull --force</h2>\n<p>Now you must be thinking, what is <code>git pull --force</code> then?</p>\n<p>it feels like it would help to overwrite local changes. instead, it fetches forcefully but does not merge forcefully (<code>git pull --force</code> = <code>git fetch --force</code> + <code>git merge</code>).</p>\n<p>Like git push, git fetch allows us to specify which local and remote branch we want to work on. <code>git fetch origin/ft-1:my-ft</code> means the changes in the <code>ft-1</code> branch from the remote repository will end up visible on the local branch <code>my-ft</code>. When such kind of operation modifies the existing history, it is not allowed by the Git without an explicit --force parameter.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n</style>","frontmatter":{"title":"How to Perform a Git Force Pull","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"December 03, 2020","updated_date":null,"tags":["git"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/496c8e02b6dc1da7410a55bf50a19942/14b42/pull.jpg","srcSet":"/static/496c8e02b6dc1da7410a55bf50a19942/f836f/pull.jpg 200w,\n/static/496c8e02b6dc1da7410a55bf50a19942/2244e/pull.jpg 400w,\n/static/496c8e02b6dc1da7410a55bf50a19942/14b42/pull.jpg 800w,\n/static/496c8e02b6dc1da7410a55bf50a19942/47498/pull.jpg 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/git-pull-force/"}}},{"node":{"id":"7ca0500d-9bbc-58e5-bc98-717c63b753d3","html":"<h2 id=\"what-is-git-cherry-pick\" style=\"position:relative;\"><a href=\"#what-is-git-cherry-pick\" aria-label=\"what is git cherry pick 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>What is Git Cherry Pick</h2>\n<p>Git cherry-pick is a powerful command that allows any specific Git commits to be selected by reference and append to the current working HEAD. The act of picking a commit from a branch and adding it to another is <strong>cherry picking</strong>. For undoing modifications, <code>git cherry-pick</code> can be useful. Say, for example, that a commit is made to the wrong branch unintentionally. You may turn to the right branch and select the commit to where it is supposed to belong. </p>\n<h2 id=\"how-to-use\" style=\"position:relative;\"><a href=\"#how-to-use\" aria-label=\"how to use 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>HOW to use</h2>\n<p>To showcase this, let us assume we have a repository with the following branches:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">alpha - beta - gama - delta   `Master`</span>\n<span class=\"grvsc-line\">     \\</span>\n<span class=\"grvsc-line\">       x - neutron - Ultraviolet `Feature`</span></code></pre>\n<p><code>git cherry-pick commitSha</code></p>\n<p>In this example, commitSha is a reference to commit. Using the git log, you can locate a commit referenced assum we wanted to use commit 'neutron' in master in this example. We make sure that we are working on the master branch first.</p>\n<p><code>git checkout master</code></p>\n<p><code>git cherry-pick neutron</code></p>\n<p>Once executed, our Git history will look like:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">alpha - beta - gama - delta - neutron  `Master`</span>\n<span class=\"grvsc-line\">     \\</span>\n<span class=\"grvsc-line\">       x - neutron - Ultraviolet `Feature`</span>\n<span class=\"grvsc-line\">\t   </span></code></pre>\n<p>The neutron commit has been successfully picked into the feature branch.</p>\n<h2 id=\"when-to-use\" style=\"position:relative;\"><a href=\"#when-to-use\" aria-label=\"when to use 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>WHEN to use</h2>\n<p>git cherry-pick is a useful tool but isn't best practice always. Cherry-picking can trigger duplicate commits, and traditional merges are preferred instead in many situations where cherry-picking would work. Git cherry-pick is a useful option for a few situations. </p>\n<h4 id=\"collaboration\" style=\"position:relative;\"><a href=\"#collaboration\" aria-label=\"collaboration 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>Collaboration</h4>\n<p>A team will often find individual members working in or around the same code sometimes. Perhaps there is a backend and frontend component of a new product feature. There may be some shared code between two sectors of the product. Perhaps the developer of the backend produces a data structure that will also need to be used by the frontend. In order to select the commit in which this hypothetical data structure was created, the frontend developer could use git cherry-pick. This selection would allow the developer of the front end to continue progress on their project side.</p>\n<h4 id=\"quick-fixes\" style=\"position:relative;\"><a href=\"#quick-fixes\" aria-label=\"quick fixes 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>Quick fixes</h4>\n<p>When a bug is discovered, it is essential to fix that quickly as possible. For example, let's say a developer has started working on a new feature. During the development of a new feature, they find an existing bug. The developer creates an explicit commit to fix this bug. This new patch commit can be cherry-picked directly to the master branch to quickly fix the bug.</p>\n<h4 id=\"undo-and-restore-commits\" style=\"position:relative;\"><a href=\"#undo-and-restore-commits\" aria-label=\"undo and restore commits 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>Undo and restore commits</h4>\n<p>A feature branch can often go stale and not be merged into a master. Often, without merging, a pull request might be closed. Git never sacrifices those commits, and they can be identified and cherry-picked back to life by commands such as git log and git reflog.</p>\n<h2 id=\"other-options\" style=\"position:relative;\"><a href=\"#other-options\" aria-label=\"other options 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>Other options</h2>\n<p><strong>-edit</strong>\nPassing the -edit option causes git to trigger a commit message before the cherry-pick process is introduced.</p>\n<p><strong>—no-commit</strong>\nThe —no-commit option executes the cherry-pick, but it transfers the contents of the target commit into the working directory of the current branch instead of making a new commit.</p>\n<p><strong>—the-signoff</strong>\nThe —signoff option adds the signature line 'signoff' to the end of the cherry-pick commit message at the end.</p>\n<p> Git cherry-pick also accepts merge strategy options and conflict resolution as well. Please check the git merge strategy documentation.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n</style>","frontmatter":{"title":"How to use Git Cherry Pick","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"November 17, 2020","updated_date":null,"tags":["git"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/da6f791029e367a6d1f983172a08cc8a/14b42/cherrypck.jpg","srcSet":"/static/da6f791029e367a6d1f983172a08cc8a/f836f/cherrypck.jpg 200w,\n/static/da6f791029e367a6d1f983172a08cc8a/2244e/cherrypck.jpg 400w,\n/static/da6f791029e367a6d1f983172a08cc8a/14b42/cherrypck.jpg 800w,\n/static/da6f791029e367a6d1f983172a08cc8a/47498/cherrypck.jpg 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/git-cherry-pick/"}}},{"node":{"id":"b72ba370-d09d-5284-914e-101c2a0f20cd","html":"<h2 id=\"every-web-developer-should-know-about-cross-domain-security\" style=\"position:relative;\"><a href=\"#every-web-developer-should-know-about-cross-domain-security\" aria-label=\"every web developer should know about cross domain security 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><strong>Every Web Developer should know about cross-domain security</strong></h2>\n<p>While working in the world of the internet, all of the complex systems are interconnected in a shareable environment. But exposing systems in the outer world will invite security vulnerabilities and data breach for the organization. Cross-domain security address this security threat by enabling information sharing in more reliable and secure environments. Cross-domain security is an inclusive approach to defending against all kinds of threats to data connections at the boundaries of sensitive or classified networks.</p>\n<h2 id=\"the-major-concepts-of-security\" style=\"position:relative;\"><a href=\"#the-major-concepts-of-security\" aria-label=\"the major concepts of security 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>The Major Concepts of Security</h2>\n<h3 id=\"100-security-doesnt-exists\" style=\"position:relative;\"><a href=\"#100-security-doesnt-exists\" aria-label=\"100 security doesnt exists 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>100% Security doesn’t exists.</h3>\n<p>There is no way of being 100% protected from being hacked. If anyone ever tells you that, they are wrong.</p>\n<h3 id=\"single-layer-of-protection-isnt-enough\" style=\"position:relative;\"><a href=\"#single-layer-of-protection-isnt-enough\" aria-label=\"single layer of protection isnt enough 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>Single layer of protection isn’t enough.</h3>\n<p>You can’t just say…</p>\n<blockquote>\n<p>\"Oh, because I even have CSP implemented, I am safe. I can cross out cross-site scripting from my vulnerabilities list because that can’t happen now.\"</p>\n</blockquote>\n<p>Maybe that is a given to some, but it is easy to find yourself thinking in this manner. In my opinion one reason that programmers can easily find themselves thinking this way is because so much of coding is black and white, 0 or 1, true or false. Security is not that so simple.</p>\n<h2 id=\"cross-origin-resource-sharing-cors\" style=\"position:relative;\"><a href=\"#cross-origin-resource-sharing-cors\" aria-label=\"cross origin resource sharing cors 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>Cross-Origin Resource Sharing (CORS)</h2>\n<p>Have you ever gotten an error that looked something like this?</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">No &#39;Access-Control-Allow-Origin&#39; header is available on the requested resource. Origin &#39;null&#39; is therefore not allowed access.</span></code></pre>\n<p>You are certainly not alone. And then you Google it, and someone tells you to urge this extension which will make all of  your problems go away!</p>\n<blockquote>\n<p> <em>Awesome, right?</em></p>\n</blockquote>\n<p><strong>CORS is there to protect you, not hurt you!</strong></p>\n<p>In order to explain how CORS helps you, let’s starts about cookies, specifically <strong>authentication cookies</strong>. Authentication cookies are wont to tell a server that you are simply logged in, and that they are automatically sent with any request you make to that server.</p>\n<blockquote>\n<p> Let’s think you’re logged in to yahoo, and they use authentication cookies. You click on bit.ly/r43nugi which redirects you to <a href=\"http://www.cryptoearn.co/\">cryptoearn</a>. A script within <a href=\"http://www.cryptoearn.co/\">cryptoearn</a> makes a client-side request to yahoo.com which sends your authentication cookie!</p>\n</blockquote>\n<p>In a no-CORS world, they might make changes to your account without you even knowing. Until, obiviously , they post bit.ly/r43nugi on your timeline, and everyone of your relative orfriends click on thereon, and then the cycle continues in an evil breadth-first scheme that conquers all of yahoo’s users, and the world is consumed by <a href=\"http://www.cryptoearn.co/\">cryptoearn</a>. ?</p>\n<p>In CORS world, however, yahoo would only allow requests with an origin of yahoo.com to edit data on their server. In other words, they might limit cross-origin resource sharing. You might then ask…</p>\n<blockquote>\n<p> <em>Well can <a href=\"http://www.cryptoearn.co/\">cryptoearn</a> just change the origin header on their request, so that it looks like it is coming from *yahoo.com</em>?*</p>\n</blockquote>\n<p>They will try, but it won’t work because the browser will just ignore it and use the actual origin.</p>\n<blockquote>\n<p> <em>Ok, but what if <a href=\"http://www.cryptoearn.co/\">cryptoearn</a> made the request server-side?</em></p>\n</blockquote>\n<p>In this case, they can bypass CORS, but they can't crack this because they won’t be ready to send your authentication cookie along for the ride. The script should be executed on the client side to urge access to your client side cookies.</p>\n<h3 id=\"what-is-a-security-policy\" style=\"position:relative;\"><a href=\"#what-is-a-security-policy\" aria-label=\"what is a security policy 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>What is a security Policy?</h3>\n<blockquote>\n<p> Servers are generally host web sites, applications, images, fonts, and many more. When you use any browser, you are likely attempting to access a definite website (that is hosted on a server). Websites often request these hosted resources from different locations (servers) on the web. Security policies on servers mitigate the risks associated with requesting assets hosted on distinct server. Let’s take a glance at an example of a security policy: <em>same-origin</em>.\nThe **same-origin *<em>policy is very restrictive. Under this policy, a document (i.e., sort of a web page) hosted on server A can only interact with other documents that also are on server A. In short, the same-origin policy enforces that documents that interact with one another have the same *origin</em>.</p>\n</blockquote>\n<p>The CORS standards manage cross-origin requests by adding a new HTTP headers to the standard list of headers. The following are the new HTTP headers added by the CORS standard:</p>\n<ul>\n<li>Access-Control-Allow-Origin</li>\n<li>Access-Control-Allow-Credentials</li>\n<li>Access-Control-Allow-Headers</li>\n<li>Access-Control-Allow-Methods</li>\n<li>Access-Control-Expose-Headers</li>\n<li>Access-Control-Max-Age</li>\n<li>Access-Control-Request-Headers</li>\n<li>Access-Control-Request-Method</li>\n<li>Origin</li>\n</ul>\n<h2 id=\"content-security-policy-csp\" style=\"position:relative;\"><a href=\"#content-security-policy-csp\" aria-label=\"content security policy csp 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>Content Security Policy (CSP)</h2>\n<p>To dig in to  CSP, we first need to talk about one of the most common vulnerabilities on the web: XSS, which means cross-site scripting.</p>\n<p>XSS is when some evil guy injects JavaScript into your client-side code. You might think…</p>\n<blockquote>\n<p> <em>What are they going to do? Change a color from red to blue?</em></p>\n</blockquote>\n<p>Let’s think of someone has successfully injected JavaScript into client-side code of a website you are visiting.</p>\n<p>What could they do that would be malicious?</p>\n<ul>\n<li>They might make HTTP requests to another site pretending to be you.</li>\n<li>They might add an anchor tag that sends you to a website that looks same to the one you are on with some slightly different, malicious characteristics.</li>\n<li>They might add a script tag with inline JavaScript.</li>\n<li>They might add a script tag that fetches a remote JavaScript file somewhere.</li>\n<li>They might add an iframe that covers the page and looks like part of the website prompting you to insert your password.</li>\n</ul>\n<p>The possibilities are endless.</p>\n<p>CSP is something prevent this from happening by limiting:</p>\n<ul>\n<li>what can be opened in an iframe</li>\n<li>what stylesheets can be loaded</li>\n<li>\n<p>where requests can be made, etc.</p>\n<p>So how does it work?</p>\n</li>\n</ul>\n<p>Whenever you click on a link or type a website URL in the address bar of your internet browser, your browser makes a GET request. It eventually makes its way to a server which serves up HTML along with HTTP headers.  for more details about what headers, open up the Network tab in your console, and visit some sites.</p>\n<p>You might see a response header that looks like below:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">content-security-policy: default-src * data: blob:;script-src *.yahoo.com *.fbcdn.net *.yahoo.net *.google-analytics.com *.virtualearth.net *.google.com 127.0.0.1:* *.spotilocal.com:* &#39;unsafe-inline&#39; &#39;unsafe-eval&#39; *.atlassolutions.com blob: data: &#39;self&#39;;style-src data: blob: &#39;unsafe-inline&#39; *;connect-src *.yahoo.com yahoo.com *.fbcdn.net *.yahoo.net *.spotilocal.com:* wss://*.yahoo.com:* https://fb.scanandcleanlocal.com:* *.atlassolutions.com attachment.fbsbx.com ws://localhost:* blob: *.cdninstagram.com &#39;self&#39; chrome-extension://boadgeojelhgndaghljhdicfkmllpafd chrome-extension://dliochdbjfkdbacpmhlcpmleaejidimm;</span></code></pre>\n<p>That is the content security policy of yahoo.com. Let’s reformat it to make it easier to read:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">content-security-policy:</span>\n<span class=\"grvsc-line\">default-src * data: blob:;</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">script-src *.yahoo.com *.fbcdn.net *.yahoo.net *.google-analytics.com *.virtualearth.net *.google.com 127.0.0.1:* *.spotilocal.com:* &#39;unsafe-inline&#39; &#39;unsafe-eval&#39; *.atlassolutions.com blob: data: &#39;self&#39;;</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">style-src data: blob: &#39;unsafe-inline&#39; *;</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">connect-src *.yahoo.com yahoo.com *.fbcdn.net *.yahoo.net *.spotilocal.com:* wss://*.yahoo.com:* https://fb.scanandcleanlocal.com:* *.atlassolutions.com attachment.fbsbx.com ws://localhost:* blob: *.cdninstagram.com &#39;self&#39; chrome-extension://boadgeojelhgndaghljhdicfkmllpafd chrome-extension://dliochdbjfkdbacpmhlcpmleaejidimm;</span></code></pre>\n<p>Now, let’s break down the directives.</p>\n<ul>\n<li><strong>default-src</strong> the CSP directives that are not explicitly listed will be restricted.</li>\n<li><strong>script-src</strong> scripts that can be loaded will be restricted</li>\n<li><strong>style-src</strong> stylesheets that can be loaded will be restricted.</li>\n<li><strong>connect-src</strong> URLs which can be loaded using script interfaces, so fetch, XHR, ajax, etc will be restricted</li>\n</ul>\n<p><em>Note:</em> there are many more CSP directives than just these four shown above. The internet browser will read the CSP header and apply those directives to everything within the HTML file that was served. If the directives are set correctly, they allow only what is required.</p>\n<p>If there is no CSP header is present, then everything goes, and nothing is restricted. Everywhere you see * , that is a wildcard. You can think of replacing * with anything and it will be allowed.</p>\n<h2 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion 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>Conclusion</h2>\n<p>Security is something that should be important to everyone, not just the people who have it explicitly named in their job title, and always try to have additional layer for better security.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\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  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\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-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n</style>","frontmatter":{"title":"Cross Domain Security","author":{"id":"Abhimanyu Singh Rathore","github":"abhir9","avatar":null},"date":"August 16, 2020","updated_date":null,"tags":["Security","Web Security","Cross-Domain"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/790cea1b5ac8ae81febf53547ae0d319/ee604/cross_domain_security.png","srcSet":"/static/790cea1b5ac8ae81febf53547ae0d319/69585/cross_domain_security.png 200w,\n/static/790cea1b5ac8ae81febf53547ae0d319/497c6/cross_domain_security.png 400w,\n/static/790cea1b5ac8ae81febf53547ae0d319/ee604/cross_domain_security.png 800w,\n/static/790cea1b5ac8ae81febf53547ae0d319/f3583/cross_domain_security.png 1200w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Abhimanyu Singh Rathore","slug":"/engineering/cross-domain-security/"}}}]},"authorYaml":{"id":"Abhimanyu Singh Rathore","bio":"He is a fun-loving technocrat, artist, photographer, nature lover, leisure traveler, and developer. He actively develops full-stack apps and programs in Go and various JavaScript frameworks and libraries, especially React.","github":"abhir9","stackoverflow":"4822703","linkedin":"abhi-rathore","medium":"@abhir95","twitter":"abhir96","avatar":null}},"pageContext":{"id":"Abhimanyu Singh Rathore","__params":{"id":"abhimanyu-singh-rathore"}}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}