<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Atharv Codes]]></title><description><![CDATA[Atharv Codes]]></description><link>https://atharvjoshi107.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 20 Nov 2026 19:46:11 GMT</lastBuildDate><atom:link href="https://atharvjoshi107.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Securing Apps: Password Hashing, RBAC, OAuth, and OpenID Connect]]></title><description><![CDATA[A layered guide to passwords, authentication, authorization, OAuth 2.0 and OpenID Connect, written while building Autharis, a self-hostable OpenID Connect…]]></description><link>https://atharvjoshi107.hashnode.dev/securing-apps-password-hashing-rbac-oauth-and-openid-connect</link><guid isPermaLink="true">https://atharvjoshi107.hashnode.dev/securing-apps-password-hashing-rbac-oauth-and-openid-connect</guid><dc:creator><![CDATA[Atharv Joshi]]></dc:creator><pubDate>Tue, 03 Nov 2026 17:27:18 GMT</pubDate><content:encoded><![CDATA[<h2>How Does a Website Know Who You Are?</h2>
<p><em>A layered guide to passwords, authentication, authorization, OAuth 2.0 and OpenID Connect, written while building Autharis, a self-hostable OpenID Connect provider.</em></p>
<h3>Let's start with a simple question</h3>
<p>You open Instagram and your feed is yours. You open Gmail and your mail is there. Nobody typed your name into the page, yet the site seems to know exactly who you are and what you’re allowed to touch.</p>
<p>It feels like magic. It isn’t. It’s a stack of small ideas, each solving its own problem, and most of the confusion around security comes from mixing them up. So we’ll build the stack one layer at a time. First, how a site safely remembers a secret. Then how it proves who you are, and how it decides what you can do. After that, how one app can act for you inside another without ever seeing your password, and finally how that same machinery can be used to say who just logged in.</p>
<p>I’m building all of this from scratch in a project called Autharis, an identity provider that other apps can use for login. I’ll point to it along the way, because designing a system teaches you things reading about one never does.</p>
<h3>Why application security matters</h3>
<p>Most real breaches look nothing like the movies. They come from ordinary mistakes. Weak or reused passwords let attackers replay leaked logins from one site on another, which is called credential stuffing. Badly stored passwords mean one database leak exposes every account. Missing access checks let a logged-in user open someone else’s data just by changing an ID in the URL. A single over-powered key reaches far more than it ever needed to. And tokens or sessions that never expire stay useful to thieves long after they should be dead.</p>
<p>Some well-known cases show how this plays out.</p>
<p>LinkedIn, in 2012, had millions of password hashes posted online. They’d been hashed with a fast algorithm and no per-user salt, so a big share were cracked quickly. It later emerged that the real number of affected accounts was much higher than first reported.</p>
<p>Adobe, in 2013, lost tens of millions of user records. The passwords were encrypted instead of properly hashed, and identical passwords produced identical results, so attackers could spot the common ones just by looking.</p>
<p>Capital One, in 2019, is a different kind of story. An attacker abused a misconfigured firewall and got credentials for a cloud role with far more permissions than it needed. From there they reached data on roughly 100 million people. Passwords had nothing to do with it. It was a failure of authorization and least privilege.</p>
<p>The costs go well past fines and cleanup. Companies lose customer trust, and users lose money, privacy and time. IBM’s yearly breach reports put the average cost in the millions of dollars.</p>
<p>Look at those three cases again and you’ll notice they fail in two different ways. LinkedIn and Adobe didn’t protect who you are, meaning your credentials. Capital One didn’t limit what an identity could do. Hold onto that split, because the rest of this article hangs on it.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/47633b31-1936-41c1-805b-5993dd3e542c.png" alt="" style="display:block;margin:0 auto" />

<p>Authentication asks “Who are you?” Logging in with a password is the example. Authorization asks “What may you do?” Only admins being able to delete users is the example. One comes before the other.</p>
<h3>Passwords: the first layer</h3>
<h4>Never store them as plain text</h4>
<p>Picture a school office with every student’s locker combination written on a sticky note at the front desk. Anyone walking past has every combination, including the one dishonest employee.</p>
<p>A database full of plain-text passwords is the same thing. Developers can read it, backups contain it, logs might leak it, and any attacker who gets in walks away with everything. Since people reuse passwords, the damage spreads to other sites too.</p>
<h4>What hashing is</h4>
<p>A hash function turns any input into a fixed-size scrambled output, and it only runs one way. You can turn <code>hunter2</code> into a long string of characters, but you can’t turn that string back into <code>hunter2</code>. Think of a blender. Making the smoothie is easy. Recovering the original fruit isn’t.</p>
<p>The same input always gives the same output, and that’s what makes it useful. The site never has to store your password. It hashes what you typed and compares the result with what it saved.</p>
<h4>Why plain hashing isn’t enough</h4>
<p>If two users both pick <code>password123</code>, a plain hash gives them identical output. Attackers love this. They build huge precomputed lists of common passwords and their hashes, then just look yours up.</p>
<p>The fix is a salt, a random value generated for each user and mixed in before hashing. Now two identical passwords produce completely different hashes, and those precomputed lists are worthless. The salt isn’t a secret. It sits right next to the hash. Its only job is to make the attacker start from scratch on every single account.</p>
<h4>Why speed is the enemy</h4>
<p>Hashes like SHA-256 are built to be fast. That’s great for checking files and awful for passwords, because a fast hash lets an attacker test billions of guesses per second. Password hashing algorithms go the other way. They’re deliberately slow and memory hungry, so every guess costs something.</p>
<h4>How bcrypt works, roughly</h4>
<p>bcrypt is a long-standing password hashing algorithm. It generates a random salt for each password and tucks it inside the final output string. It then runs an intentionally expensive process many times over, and a cost factor sets how many. As computers get faster you raise the cost factor, so the work stays painful for attackers while a real login still takes only a fraction of a second.</p>
<p>It has quirks, like a limit on how many characters of the password it actually looks at. Newer algorithms such as Argon2id also make each guess expensive in memory, which hurts attackers using specialized hardware. Autharis uses Argon2id with parameters based on OWASP’s minimum recommendations. The principle matches bcrypt: salted, slow and tunable.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/a73f203e-b706-4497-a872-22702779c28d.png" alt="" style="display:block;margin:0 auto" />

<h4>How verification works</h4>
<p>When you log in, the server never decrypts anything. It repeats the recipe. It looks up your stored record and reads the salt out of it, hashes the password you just typed using that salt and those settings, and compares the result with the stored hash. A match means the password was right.</p>
<p>There’s one subtle trap here. If the email doesn’t exist, a careless server answers instantly, and an attacker can measure that timing gap to find out which emails have accounts. A good server does the same slow work anyway, using a dummy hash, and returns the same generic error either way.</p>
<h4>Storing passwords well</h4>
<p>Use a purpose-built algorithm like Argon2id, bcrypt or scrypt. Never plain text, never encryption, and never a fast hash such as MD5 or SHA-1. Let the library handle salting, because inventing your own scheme is how mistakes happen. Set a sensible minimum length, and a maximum around 128 characters so nobody can submit a megabyte-long password just to burn your CPU. Rate limit login attempts per IP address and per account. And don’t log passwords, even by accident in an error message.</p>
<h3>Authentication vs authorization</h3>
<p>Authentication, often shortened to authn, is proving your identity. Typing a password, scanning a fingerprint or entering a code from your phone all count. When it works, the system can say “this request comes from Riya.”</p>
<p>Authorization, or authz, decides what an identified person is allowed to do. Riya can read her own messages but not anyone else’s. She can edit her profile but can’t delete other accounts.</p>
<p>You need both. Think of a cinema. The ticket check at the door is authentication, since it confirms you belong. The seat number on the ticket is authorization, since it decides where you sit. A system with only authentication lets any logged-in user do anything. A system with only authorization has rules but no idea who it’s applying them to.</p>
<p>You’ve seen this everywhere. In Google Docs you log in, and then you can view a document but not edit it because the owner shared it as view-only. On Netflix your password gets you in, and your plan decides whether you can stream in 4K. On a college portal your student ID gets you in, students see their own grades, and professors can enter grades for their own course.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/2abe2487-2984-47b7-8d75-1102b5facac6.png" alt="" style="display:block;margin:0 auto" />

<p>If you only remember one thing from this section, make it the two status codes. A 401 means “I don’t know who you are.” A 403 means “I know exactly who you are, and the answer is no.”</p>
<h3>Role-Based Access Control (RBAC)</h3>
<p>Say your app has 10,000 users and 40 different actions. Assigning each action to each person individually means up to 400,000 decisions to manage. Nobody can keep that straight.</p>
<p>RBAC adds a layer in the middle. You give permissions to roles, then assign roles to users. A user is a person or account. A role is a named job function, like moderator. A permission is one specific allowed action, like <code>delete_comment</code>. When someone joins the moderation team, you assign one role instead of ten permissions. When the rules for that role change, you change them in one place.</p>
<p>A simple setup has three levels. Users can read content, edit their own profile, post comments and delete their own comments. Moderators can do all that and also hide or delete any comment and review reports. Admins can do everything a moderator can, plus manage users, change roles and view audit logs.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/2079052d-0aa8-4f44-beb8-d480b4665e64.png" alt="" style="display:block;margin:0 auto" />

<p>Autharis starts with the simplest useful version, just two roles, user and admin. The role lives in the database, and every admin request checks it there, not in a token or a hidden form field. So if an admin gets demoted or disabled, it takes effect immediately.</p>
<h4>Common patterns</h4>
<p>Inheritance means higher roles automatically include the permissions of lower ones, like the example above. It’s easy to reason about, but it can grant more than you meant to. Flat roles don’t inherit, so a user gets exactly the roles assigned, say billing plus support. That takes slightly more setup but stays tighter. Scoped roles apply inside a context, like “editor of this project” or “admin of this workspace,” and almost every SaaS product works this way. Separation of duties requires different people for powerful actions, such as one person requesting a refund and another approving it.</p>
<h4>Scaling permissions</h4>
<p>RBAC works fine until roles multiply out of control and you end up with something like “regional-sales-manager-emea-readonly.” Teams usually deal with this in a few ways. They keep roles coarse and put the fine detail in permissions. They check permissions in code instead of role names, so you write <code>can(user, "comment:delete")</code> and not <code>if (user.role === "admin")</code>. That way roles can change without rewriting your code. They add attribute-based rules, called ABAC, for context like “can edit a document only if they own it” or “only during office hours.” They always enforce on the server, because hiding a button in the UI is a convenience and not security. And they log changes to roles and permissions, so they can answer “who gave this account admin access?”</p>
<h3>OAuth 2.0, explained from the problem up</h3>
<p>Say you use a photo-printing app and want to print pictures from Google Photos. How does the printing app get at them?</p>
<p>The old, terrible answer was to hand the app your Google password. Think about what that means. The app can now read your email, your documents and everything else, not just photos. You can’t limit it, because it’s all or nothing. You can’t cut it off without changing your Google password, which breaks everything else too. If the app gets hacked, your Google password goes with it. And Google can’t even tell whether it’s you or the app doing something.</p>
<p>It’s like giving a valet your house key when all they need is the car key. OAuth exists to hand out the car key.</p>
<p>OAuth 2.0 gives an application limited, temporary, revocable access to your data without sharing your password. Instead of the password, the app gets a special-purpose token.</p>
<p>There are four players. The resource owner is you, the person who owns the data. The client is the app that wants access, here the photo printer. The authorization server checks who you are, asks your permission and issues tokens, which in this case is Google’s login and consent screens. The resource server is the API that holds the data and accepts tokens, like the Google Photos API.</p>
<p>In plain language the flow goes like this. You click “Connect Google Photos” in the printing app. The app sends you to Google instead of showing its own form. You log in at Google, and the printing app never sees your password. Google shows a consent screen along the lines of “Printer app wants to view your photos. Allow?” You approve, and Google sends the app a short-lived, one-time code through your browser. The app swaps that code for an access token, then uses the token to fetch your photos and nothing else.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/6b19d75e-c520-47b4-b2e0-91c8e9d63cf0.png" alt="" style="display:block;margin:0 auto" />

<p>An access token works like a hotel key card. It opens specific doors, which is the scope. It works for a limited time. And the front desk can deactivate it without changing the locks on the whole building.</p>
<p>Because tokens are powerful, good systems keep them short-lived. Autharis access tokens last 10 minutes. If an app needs longer access, it can use a refresh token to quietly request new access tokens. Refresh tokens get guarded more carefully. They’re rotated on every use, and if an old one ever shows up again, the whole family gets revoked, since that signals theft.</p>
<p>This is what runs underneath “Login with Google.” But there’s a catch, and it’s the most misunderstood fact in this whole topic. OAuth on its own is about authorization, not login. It tells an app “you may access these photos.” It doesn’t formally tell the app who the user is. That gap is where the next layer comes in.</p>
<h3>OpenID Connect (OIDC)</h3>
<p>Developers wanted “Login with Google,” so they started using OAuth access tokens to guess at identity. Every provider did it a little differently, and some of those shortcuts were insecure. The industry needed one standard way to say “here’s who just logged in.”</p>
<p>OpenID Connect is a thin identity layer built on top of OAuth 2.0. The login flow is nearly identical. What changes is what comes back. OAuth returns an access token, which says “this app may call this API.” OIDC also returns an ID token, which says “this person is who we say they are.”</p>
<p>The ID token is a signed digital document with facts about the login. It carries a unique user identifier, who issued the token, which app it was issued for, when the user logged in and when the token expires. Because it’s digitally signed, the app can check that it really came from the provider and hasn’t been altered. Think of it as a tamper-evident ID card.</p>
<p>One detail worth knowing is that the identifier inside the token is a stable, unique ID, not the email address. People change emails, and emails can get reassigned to someone else. Autharis uses the user’s database ID for exactly that reason.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/8995bcf4-12bc-4e61-823a-722bbb6567d4.png" alt="" style="display:block;margin:0 auto" />

<p>So here’s how the four ideas answer different questions. Authentication answers who you are, and it’s a concept, with entering a password as the example. Authorization answers what you may do, also a concept, like only admins deleting users. OAuth 2.0 is a delegation framework that answers whether an app can access your data on your behalf, and it produces an access token. The printer app reading your photos is the classic case. OpenID Connect is an identity layer on top of OAuth that answers who just logged in, and it produces an ID token alongside the access token. “Continue with Google” is the everyday example.</p>
<p>This matters because the client app never handles your password and doesn’t need its own credential database. It trusts a provider to do the hard, security-critical work once, and do it correctly. It’s why a student can sign into a dozen unrelated services with one account, and why a company can run a single identity system across all its products.</p>
<h3>Modern authentication architecture</h3>
<p>Login has gone through roughly three eras.</p>
<p>In traditional login, each app owns its own user table, its own password storage and its own reset emails. It’s simple to start, but every app has to get security right on its own, and users end up juggling dozens of passwords.</p>
<p>Social login came next. The app hands the job to Google, GitHub or Apple using OIDC. Users get less friction and developers carry less password liability. The trade-off is depending on a third party.</p>
<p>Enterprise authentication is the third. Companies manage employees centrally, so joining grants access to the right tools and leaving removes access to everything at once. It’s built on standards like OIDC and SAML, with providers such as Okta, Microsoft Entra ID and Keycloak.</p>
<p>Single Sign-On, or SSO, is what ties it together. You log in once to a central identity provider and every connected app trusts that login. Open your company mail, calendar, chat and HR portal back to back and nobody asks for a password again. You get one strong login, one place for multi-factor authentication, and one switch to flip when someone leaves.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/ee9fc482-ad74-4d44-b37e-ae057f193b16.png" alt="" style="display:block;margin:0 auto" />

<p>Autharis is an identity provider of this kind. Client apps redirect users to it, and it handles passwords, sessions and consent, then hands the app an ID token. It’s built as a modular monolith, which means one deployable program split internally into modules like identity, sessions, tokens and admin, with strict rules about who may talk to whom. Requests move through clear layers (routes, controllers, services, repositories and the database), and every security decision lives in the services layer so it’s easy to find and test.</p>
<p>A typical SaaS product pulls all of this together. It offers email and password sign-in, social login, and enterprise SSO for paying business customers. It treats multi-factor authentication as standard. Users belong to workspaces with scoped roles like owner, admin, member and viewer. Third-party integrations get OAuth tokens so users can connect other tools safely. And audit logs record sign-ins, role changes and sensitive actions.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/8c4a2d3c-6b78-4c57-94e6-717bac018ef9.png" alt="" style="display:block;margin:0 auto" />

<h3>Security practices used in production</h3>
<h4>Strong password policy</h4>
<p>Modern guidance favors length over complexity. A long passphrase beats <code>P@ssw0rd!</code>. Set a sensible minimum (Autharis requires at least 12 characters), allow long passwords and spaces, and check passwords against lists of known-breached ones. Skip forced periodic changes, since they push people toward predictable patterns.</p>
<h4>Multi-factor authentication</h4>
<p>MFA asks for a second proof beyond the password. That could be something you know, like the password, something you have, like a phone or hardware key, or something you are, like a fingerprint. Even if a password leaks, the attacker is stuck. Authenticator apps, hardware keys and passkeys are better choices than SMS codes, which can be intercepted.</p>
<p>I’ll also be straight about scope. In my own project plan, MFA is marked as a required addition before production use. Knowing what your system doesn’t do yet is part of security.</p>
<h4>Token expiration</h4>
<p>Every token and session should die on its own schedule. Access tokens live for minutes. ID tokens also live for minutes and get used once at login. Refresh tokens last days to weeks and are rotated on use. Sessions get both an idle timeout (Autharis uses 2 hours) and an absolute limit (12 hours). A stolen token that expires in 10 minutes is a nuisance. One that never expires is a disaster.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/c2e9ee77-5e9f-468c-b98c-24ab9bb1a51b.png" alt="" style="display:block;margin:0 auto" />

<h4>Storing credentials safely</h4>
<p>Passwords get salted, slow hashes and nothing else. Tokens, session IDs and client secrets should be stored as a hash only, so a database leak doesn’t hand attackers working credentials. Random, high-entropy values don’t need a slow hash, but they must never sit in the database raw.</p>
<p>Signing keys belong outside the codebase and the database, with tight file permissions and a plan for rotation. Never commit <code>.env</code> files or keys to Git, and add them to <code>.gitignore</code> before the first commit. For cookies, use <code>HttpOnly</code> so scripts can’t read them, <code>Secure</code> so they only travel over HTTPS, and <code>SameSite</code> to limit cross-site sending. And keep passwords, tokens and secrets out of your logs.</p>
<h4>Least privilege</h4>
<p>Every person, service and token should get the minimum access its job needs. A reporting tool that only reads data shouldn’t hold write credentials. An OAuth app that wants to read your calendar shouldn’t ask for your contacts. This one habit would have limited the Capital One incident, and it keeps the damage small when something does eventually get compromised.</p>
<h4>Protecting sensitive routes</h4>
<p>Check on the server every single time. Don’t trust hidden buttons, client-side flags or role names sent from the browser. Deny by default, so a new route stays locked until someone deliberately opens it. Ask people to re-authenticate for dangerous actions like changing an email address or doing admin work.</p>
<p>Defend against CSRF, which is a forged request sent from another site using your logged-in cookie, with tokens and <code>SameSite</code> cookies. Rate limit login, token and password reset routes. Return generic errors, because “Invalid email or password” reveals nothing while “No account with that email” helps an attacker. And keep an audit trail for admin actions and security events.</p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/4e7fb9b1-0627-437a-89f0-a102f05f23a5.png" alt="" style="display:block;margin:0 auto" />

<h3>Putting it all together</h3>
<p>Back to the opening question. How does a website know who you are?</p>
<p>It stored a slow, salted hash of your password, not the password itself. It authenticated you by hashing what you typed and comparing the two. It gave you a short-lived session so you don’t retype your password on every click. On each request it checked what you’re allowed to do against your roles and permissions.</p>
<p>If another app needs to act for you, OAuth hands out a limited, revocable token instead of your password. If an app only wants to know who you are, OpenID Connect delivers a signed ID token from a provider it trusts. And all the way through, least privilege, short expiry, MFA and auditing keep the damage small when something goes wrong.</p>
<p>The main thing is to keep the questions separate. Who are you is authentication. What can you do is authorization. May this app act for me is OAuth. Who just logged in is OIDC. Systems that keep those four apart are much easier to design, test and secure.</p>
<p>If you’d like to see these ideas turned into working code, follow along as Autharis grows into a spec-compliant OpenID Connect provider. Questions or corrections? Drop them in the comments.</p>
]]></content:encoded></item><item><title><![CDATA[Git for Beginners: Basics and Essential Commands]]></title><description><![CDATA[Git It is a version control system which helps in keeping track of the source code written by developers and manage it over time. Instead of recording file…]]></description><link>https://atharvjoshi107.hashnode.dev/git-for-beginners-basics-and-essential-commands</link><guid isPermaLink="true">https://atharvjoshi107.hashnode.dev/git-for-beginners-basics-and-essential-commands</guid><dc:creator><![CDATA[Atharv Joshi]]></dc:creator><pubDate>Mon, 27 Jul 2026 11:35:06 GMT</pubDate><content:encoded><![CDATA[<p><strong>Git</strong></p>
<p>It is a version control system which helps in keeping track of the source code written by developers and manage it over time. Instead of recording file changes it takes snapshots of the small changes that took place over time and saves it.</p>
<p>A version control system can be distributed or centralized. Some examples of distributed VCS are git, mercurial, fossil etc. Some examples of centralized VCS are SVN(Subversion), perforce, TFVC etc.</p>
<p><strong>Why Git is used?</strong></p>
<p>Git is used for version control. It tracks changes to a codebase over time, allows multiple developers to collaborate without overwriting each other's work, maintains a history of all changes, and makes it easy to revert to previous versions when necessary.</p>
<p><strong>Some basics terminologies of git</strong></p>
<p>Git comprises of 3 local states: working directory, staging area and local directory.</p>
<p>Repo: It is a directory/folder tracked by git that stores information of all the files and contains all history about it.</p>
<p>Commit: It is a snapshot of all the changes made from the beginning (if repo has just been initialized) or from the last commit made by the user (when their exists pervious commits).</p>
<p>Branch: Just like a tree has branches in it, git also offers a programmer to create different branches on which he/she can work without changing the code of the main branch from which other branches are created. One can work on their separate branch and merge after the feature on which they are working has been completed</p>
<p>Head: It points/references to the current branch you are working on.</p>
<p><strong>Essential Commands</strong></p>
<p><code>git init</code></p>
<p>This command helps initialize .git folder in the directory you are currently present.</p>
<p><code>git add</code></p>
<p>This command helps add the changes that have been made since previous commit (if there exists one) or all the changes made since repo was initialized/created.</p>
<p>To add particular files:</p>
<p><code>git add &lt;filename&gt;</code></p>
<p>To add all files:</p>
<p><code>git add .</code></p>
<p><code>git status</code></p>
<p>This command helps the programmer by telling what all files have been added, modified, deleted etc. Gives info about what files are in staging area and are ready to be committed.</p>
<p><code>git commit -m "message"</code></p>
<p>This command helps you take a snapshot of all the changes you made since previous commit, and this needs to be run after git add. A message is required to be written while committing (a good practice is that it should be written in present tense).</p>
<p><code>git checkout &lt;branch name&gt;</code></p>
<p>This command is used to switch between different branches available in a repository.</p>
<p><code>git checkout -b &lt;branch name&gt;</code></p>
<p>This command helps you create a new branch with the name specified by the user and enter it without the need of using git checkout command explicitly.</p>
<p><code>git push</code></p>
<p>This command helps send/update the changes made in the local repo (on your computer) to remote (server, eg. GitHub)</p>
<p>Command:</p>
<p><code>git push -u origin main</code></p>
<p>In the above command -u tells about the upstream, origin is the name of remote repo and main is the branch to which changes are to be pushed.</p>
<p><code>git log</code></p>
<p>This command helps you know the history of commits that have been made. It gives info like commit hash, author, date and message that was been given at the time of commit.</p>
<p>All of this can make your terminal clustered, to fix this we can use <code>git log --online</code> now it just gives Abbreviated SHA-1 Hash, commit messages and info about current head branch.</p>
<p><strong>Git Workflow</strong></p>
<img src="https://cdn.hashnode.com/uploads/covers/6a65c0f579291e4d3ccd79c9/4e95f8be-38a1-4c34-bc40-c5826a0334bd.png" alt="" style="display:block;margin:0 auto" />]]></content:encoded></item></channel></rss>