When you go to McDonald’s🍔 & order a “Double Quarter Pounder Burger with whole wheat bread bun, some extra Cheese with less tomatoes slice & extra mayonnaise with a large Coke”🍔🍶 (By the way thats a huge burger man 😂)
The moment you place Order:
🍔 The manager will shout out your order within the team🗣️
🍔 2 3 people will start separately working on your order like one on chicken patty part, one on wheat bread bun, one on veggies & one on your soft drink so on🕴🏻🕴🏻
🍔 They all will first “Pull” the latest stock they have in their respective inventory like bread, veggies, chicken patty & all.
🍔 The moment all 3 4 guys are ready with their individual task, they come at a single place with their result🤌🏻😎
🍔 They will add & merge all their results in a wrapper
🍔 Then push it in a box & boom it will be handed over to you🥳
And This is how exactaly Git concept works✅🎉
The moment your Team gets a Project like “Create a Calculator”
👨🏻💻Your Team Lead will shout out the task within the Team➕✖️➗
👨🏻💻 2 3 developers, will start separately working on different features of Calculator like one on Addition➕, one on Division➗ & so on.
👨🏻💻They will first “Pull”, at present the latest code, of your project, from Github/Bitbucket or wherever your project is stored into their local machines💻💻
👨🏻💻 Once all 2 3 guys, are ready with their respective task, they all will “push” their code at a single place📥
👨🏻💻They will “merge” all their work & boom the Calculator is ready✅🎉
Lets now dig a bit deeper on the Practical & Processing part of Git🧙🏼♂️⚙️
Note: Keep patience for next 3 mints and read calmly, lets start😎️
The moment you are asked to code & add a new feature in your existing project code repo, you will first
🔥Clone the code repo by command : git clone
Your company will be storing their code in a repo on Github or Bitbucket, they will create your account as well there, so login into that account, go to the code repo and use the command
🧞♂”️git clone https://[email protected]/sample_repo.git -b develop” The “-b develop” will clone the develop branch, from many other branches present in your main code repo of team.
🔥Now once you have project’s develop branch code, you will create your own branch from it (like your own working space)
🧞♂️git checkout -b mohit/feature_calculator_addition “mohit/feature_calculator_addition” this branch is your private space, separated from your main team project, this will help to avoid any issue, from your side, in the main code of the team.
🔥Start doing the changes or code addition you want and once done do
🧞♂️git status : It will show all the scripts you have made changes to.
🧞♂️git add a.py b.py: This will add the changed script to a staging/space where they are made ready to be now pushed to main repo.
🧞♂️git commit -m “added addition feature”: This will be your msg to the team for the code you have worked on.
🧞♂️git push origin mohit/feature_calculator_addition: This will push your entire code to the branch you have created.
🔥Till now you have taken pull of the team’s code, created your own branch, worked on it, pushed the code to “your” branch.
But all this is at “your” level till now, so to put all this, in teams code repo you will raise a “Pull Request” to your Team Lead.
🔥Login to your Bitbucket/Github console -> Go to Pull Request tab, select from where to where you want to move your code. From: mohit/feature_calculator_addition To: Develop
🔥Once you raise the PR, by adding your team lead name, he will be notified & he can see your changes in all those scripts you have made.
🔥If he/she feels it’s proper, lead will accept your code & merge it in the teams’s develop branch or else he will reject it with a message by him & you will be notified why it’s been rejected & you will do the necessary changes & will raise a PR.
🔥Also when you raise a PR, there can be a scenario where you and one other team member have made changes in the exact same script in exactly the same line, now this will give a “Merge Conflict” when code will be added to the main branch🤕
Merge conflicts happen when you merge two branches that have competing/smiliar commits, and Git needs your help to decide which/whose changes to incorporate in the final merge.
🔥You have to resolve this merge conflict, by either changing the code’s position or by deciding which one of you will be keeping your code on that paticular line giving merge conflict🥶
🥳Once resolved, the final code will be added to the project’s repo code🥳
🤷🏻♂️Now the most asked question: What is Git and GitHub ?🙄
See Internet is a concept, on which we are making and using Whatsapp, Facebook, Gmail🤖
Same way, Git is the concept, an approach on which Github & Bitbucket have opened their shops, of giving developer a space, where we can save our code & version them, so that if by chance we have issue in our Production code, we can just rollback to our second last release code & can publish it for customer🥳
There are many more, deep down things in Git, but this article’s approach was to just give you a brief idea, about the concept of git, so that later on it will be easy for you to connect dots about git by any tutorial you like🤌🏻😎
And Thank You for being here with me and for your love🫶🏻🙌🏻 It makes me so happy 😃 seeing a clap 👏🏻 or a comment✍🏻 or seeing article shared by someone. It makes all the efforts worth 🙏🏻
So that’s all from now, hope you have enjoyed the Git burger 🍔😂 as well the concept. Wish you all a happy learning and an awesome year ahead🥳
Quello che ho imparato sull’amore è che l’amore esiste….non dimentichiamo mai le persone che abbiamo amato, perché rimangono sempre con noi; qualcosa le lega a noi in modo indissolubile, anche se non ci sono più.
Ho imparato che ci sono amori impossibili, amori incompiuti, amori che potevano essere e non sono stati.
Ho imparato che è meglio una scia bruciante, anche se lascia una cicatrice: meglio l’incendio che un cuore d’inverno.”