[{"data":1,"prerenderedAt":1036},["Reactive",2],{"content-query-6o63ucB64j":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"createdAt":10,"updatedAt":10,"thumbnail":11,"thumbnailMobile":12,"social":13,"author":14,"tags":16,"readingTime":19,"body":24,"_type":1031,"_id":1032,"_source":1033,"_file":1034,"_extension":1035},"/blog/git","blog",false,"","The ultimate git guide","Git is the most commonly used version control system. Git tracks the changes you make to files, so you have a record of...","2021-01-09T03:01:50.854Z","/thumb/git.webp","/thumb/git mobile.webp","/thumb/git.jpg",{"name":15},"Zakaria",[17,18],"web dev","coding tips",{"text":20,"minutes":21,"time":22,"words":23},"6 min read",5.03,301800,1006,{"type":25,"children":26,"toc":1023},"root",[27,41,51,56,76,83,144,150,177,257,275,439,457,489,506,512,530,539,557,745,753,759,817,822,878,884,892,923,965,971,979,998,1017],{"type":28,"tag":29,"props":30,"children":31},"element","p",{},[32,39],{"type":28,"tag":33,"props":34,"children":35},"strong",{},[36],{"type":37,"value":38},"text","Git",{"type":37,"value":40}," is the most commonly used version control system.",{"type":28,"tag":29,"props":42,"children":43},{},[44,49],{"type":28,"tag":33,"props":45,"children":46},{},[47],{"type":37,"value":48},"GitHub",{"type":37,"value":50}," is a cloud-based hosting service that lets you manage Git repositories. It is widely used and it is the one I use myself.",{"type":28,"tag":29,"props":52,"children":53},{},[54],{"type":37,"value":55},"Git allows developers to:",{"type":28,"tag":57,"props":58,"children":59},"ul",{},[60,66,71],{"type":28,"tag":61,"props":62,"children":63},"li",{},[64],{"type":37,"value":65},"Tracks the changes you make to files, so you have a record of what has been done.",{"type":28,"tag":61,"props":67,"children":68},{},[69],{"type":37,"value":70},"Revert to specific versions should you ever need to.",{"type":28,"tag":61,"props":72,"children":73},{},[74],{"type":37,"value":75},"Makes collaboration easier, allowing changes by multiple people to all be merged into one source.",{"type":28,"tag":77,"props":78,"children":80},"h2",{"id":79},"_0-terminology",[81],{"type":37,"value":82},"0- Terminology",{"type":28,"tag":57,"props":84,"children":85},{},[86,96,106,116,126],{"type":28,"tag":61,"props":87,"children":88},{},[89,94],{"type":28,"tag":33,"props":90,"children":91},{},[92],{"type":37,"value":93},"Snapshot:",{"type":37,"value":95}," just like in photography, a snapshot in computer science represents a moment (timestamped), where the system was in a certain state.",{"type":28,"tag":61,"props":97,"children":98},{},[99,104],{"type":28,"tag":33,"props":100,"children":101},{},[102],{"type":37,"value":103},"Commit:",{"type":37,"value":105}," In short, a commit is a snapshot of your Git repository at one point in time.",{"type":28,"tag":61,"props":107,"children":108},{},[109,114],{"type":28,"tag":33,"props":110,"children":111},{},[112],{"type":37,"value":113},"Push request:",{"type":37,"value":115}," synchronizing changes from a local repository (folder) to a remote one.",{"type":28,"tag":61,"props":117,"children":118},{},[119,124],{"type":28,"tag":33,"props":120,"children":121},{},[122],{"type":37,"value":123},"Remote vs Local:",{"type":37,"value":125}," Remote refers to the version of the project sitting on the cloud (Github in this case). Local refers to the version of the project that you have on your machine.",{"type":28,"tag":61,"props":127,"children":128},{},[129,134,136,142],{"type":28,"tag":33,"props":130,"children":131},{},[132],{"type":37,"value":133},"The working tree:",{"type":37,"value":135}," The working tree, or working directory, consists of files that you are currently working on, if there is nothing to commit then the ",{"type":28,"tag":137,"props":138,"children":139},"em",{},[140],{"type":37,"value":141},"git status",{"type":37,"value":143}," will return a clean working tree.",{"type":28,"tag":77,"props":145,"children":147},{"id":146},"_1-new-project",[148],{"type":37,"value":149},"1- New project",{"type":28,"tag":57,"props":151,"children":152},{},[153],{"type":28,"tag":61,"props":154,"children":155},{},[156,158,164,166,175],{"type":37,"value":157},"After creating a new account on Github, and installing git locally from your Linux terminal: ",{"type":28,"tag":159,"props":160,"children":161},"code",{"className":7},[162],{"type":37,"value":163},"apt-get install git",{"type":37,"value":165}," ( for windows & mac check this ",{"type":28,"tag":167,"props":168,"children":172},"a",{"href":169,"rel":170},"https://github.com/git-guides/install-git",[171],"nofollow",[173],{"type":37,"value":174},"link",{"type":37,"value":176}," ), you need to configure the email and username:",{"type":28,"tag":178,"props":179,"children":183},"pre",{"className":180,"code":181,"language":182,"meta":7,"style":7},"language-bash shiki shiki-themes material-theme","git config --global user.name name #replace with your github name\ngit config --global user.email email #replace with your github email\n","bash",[184],{"type":28,"tag":159,"props":185,"children":186},{"__ignoreMap":7},[187,226],{"type":28,"tag":188,"props":189,"children":192},"span",{"class":190,"line":191},"line",1,[193,199,205,210,215,220],{"type":28,"tag":188,"props":194,"children":196},{"style":195},"--shiki-default:#FFCB6B",[197],{"type":37,"value":198},"git",{"type":28,"tag":188,"props":200,"children":202},{"style":201},"--shiki-default:#C3E88D",[203],{"type":37,"value":204}," config",{"type":28,"tag":188,"props":206,"children":207},{"style":201},[208],{"type":37,"value":209}," --global",{"type":28,"tag":188,"props":211,"children":212},{"style":201},[213],{"type":37,"value":214}," user.name",{"type":28,"tag":188,"props":216,"children":217},{"style":201},[218],{"type":37,"value":219}," name",{"type":28,"tag":188,"props":221,"children":223},{"style":222},"--shiki-default:#546E7A;--shiki-default-font-style:italic",[224],{"type":37,"value":225}," #replace with your github name\n",{"type":28,"tag":188,"props":227,"children":229},{"class":190,"line":228},2,[230,234,238,242,247,252],{"type":28,"tag":188,"props":231,"children":232},{"style":195},[233],{"type":37,"value":198},{"type":28,"tag":188,"props":235,"children":236},{"style":201},[237],{"type":37,"value":204},{"type":28,"tag":188,"props":239,"children":240},{"style":201},[241],{"type":37,"value":209},{"type":28,"tag":188,"props":243,"children":244},{"style":201},[245],{"type":37,"value":246}," user.email",{"type":28,"tag":188,"props":248,"children":249},{"style":201},[250],{"type":37,"value":251}," email",{"type":28,"tag":188,"props":253,"children":254},{"style":222},[255],{"type":37,"value":256}," #replace with your github email\n",{"type":28,"tag":57,"props":258,"children":259},{},[260,265,270],{"type":28,"tag":61,"props":261,"children":262},{},[263],{"type":37,"value":264},"You can also edit the config file manually, as it will be set on your home repo (Linux based systems): ~/.gitconfig",{"type":28,"tag":61,"props":266,"children":267},{},[268],{"type":37,"value":269},"To start a new git project, create a new repository from your Github account without initializing it.",{"type":28,"tag":61,"props":271,"children":272},{},[273],{"type":37,"value":274},"Then in your local machine, cd to the project folder and do the following:",{"type":28,"tag":178,"props":276,"children":278},{"className":180,"code":277,"language":182,"meta":7,"style":7},"# init an empty repo with the branch main\ngit init -b main\n# it tracks all the changes made to the folder\ngit add .\ngit commit -m \"first commit\"\n# replace that with your actual repo link\ngit remote add origin https://github.com/user/repo.git\n# you will be prompted to enter your github password\ngit push origin main\n",[279],{"type":28,"tag":159,"props":280,"children":281},{"__ignoreMap":7},[282,290,312,321,339,373,382,409,418],{"type":28,"tag":188,"props":283,"children":284},{"class":190,"line":191},[285],{"type":28,"tag":188,"props":286,"children":287},{"style":222},[288],{"type":37,"value":289},"# init an empty repo with the branch main\n",{"type":28,"tag":188,"props":291,"children":292},{"class":190,"line":228},[293,297,302,307],{"type":28,"tag":188,"props":294,"children":295},{"style":195},[296],{"type":37,"value":198},{"type":28,"tag":188,"props":298,"children":299},{"style":201},[300],{"type":37,"value":301}," init",{"type":28,"tag":188,"props":303,"children":304},{"style":201},[305],{"type":37,"value":306}," -b",{"type":28,"tag":188,"props":308,"children":309},{"style":201},[310],{"type":37,"value":311}," main\n",{"type":28,"tag":188,"props":313,"children":315},{"class":190,"line":314},3,[316],{"type":28,"tag":188,"props":317,"children":318},{"style":222},[319],{"type":37,"value":320},"# it tracks all the changes made to the folder\n",{"type":28,"tag":188,"props":322,"children":324},{"class":190,"line":323},4,[325,329,334],{"type":28,"tag":188,"props":326,"children":327},{"style":195},[328],{"type":37,"value":198},{"type":28,"tag":188,"props":330,"children":331},{"style":201},[332],{"type":37,"value":333}," add",{"type":28,"tag":188,"props":335,"children":336},{"style":201},[337],{"type":37,"value":338}," .\n",{"type":28,"tag":188,"props":340,"children":342},{"class":190,"line":341},5,[343,347,352,357,363,368],{"type":28,"tag":188,"props":344,"children":345},{"style":195},[346],{"type":37,"value":198},{"type":28,"tag":188,"props":348,"children":349},{"style":201},[350],{"type":37,"value":351}," commit",{"type":28,"tag":188,"props":353,"children":354},{"style":201},[355],{"type":37,"value":356}," -m",{"type":28,"tag":188,"props":358,"children":360},{"style":359},"--shiki-default:#89DDFF",[361],{"type":37,"value":362}," \"",{"type":28,"tag":188,"props":364,"children":365},{"style":201},[366],{"type":37,"value":367},"first commit",{"type":28,"tag":188,"props":369,"children":370},{"style":359},[371],{"type":37,"value":372},"\"\n",{"type":28,"tag":188,"props":374,"children":376},{"class":190,"line":375},6,[377],{"type":28,"tag":188,"props":378,"children":379},{"style":222},[380],{"type":37,"value":381},"# replace that with your actual repo link\n",{"type":28,"tag":188,"props":383,"children":385},{"class":190,"line":384},7,[386,390,395,399,404],{"type":28,"tag":188,"props":387,"children":388},{"style":195},[389],{"type":37,"value":198},{"type":28,"tag":188,"props":391,"children":392},{"style":201},[393],{"type":37,"value":394}," remote",{"type":28,"tag":188,"props":396,"children":397},{"style":201},[398],{"type":37,"value":333},{"type":28,"tag":188,"props":400,"children":401},{"style":201},[402],{"type":37,"value":403}," origin",{"type":28,"tag":188,"props":405,"children":406},{"style":201},[407],{"type":37,"value":408}," https://github.com/user/repo.git\n",{"type":28,"tag":188,"props":410,"children":412},{"class":190,"line":411},8,[413],{"type":28,"tag":188,"props":414,"children":415},{"style":222},[416],{"type":37,"value":417},"# you will be prompted to enter your github password\n",{"type":28,"tag":188,"props":419,"children":421},{"class":190,"line":420},9,[422,426,431,435],{"type":28,"tag":188,"props":423,"children":424},{"style":195},[425],{"type":37,"value":198},{"type":28,"tag":188,"props":427,"children":428},{"style":201},[429],{"type":37,"value":430}," push",{"type":28,"tag":188,"props":432,"children":433},{"style":201},[434],{"type":37,"value":403},{"type":28,"tag":188,"props":436,"children":437},{"style":201},[438],{"type":37,"value":311},{"type":28,"tag":57,"props":440,"children":441},{},[442,452],{"type":28,"tag":61,"props":443,"children":444},{},[445,450],{"type":28,"tag":33,"props":446,"children":447},{},[448],{"type":37,"value":449},"Update",{"type":37,"value":451}," As of 2022 password connections are no longer supported, you need to go to your account developers' settings and generate a token (with reading/write permissions).",{"type":28,"tag":61,"props":453,"children":454},{},[455],{"type":37,"value":456},"Most of the time there are files that you don't want to commit to production, for that create a .gitignore file in your root project folder, and fill it with the paths of files & folders that you want to ignore. You can also set up a global gitignore file to always include it in your projects, configure it once and use it:",{"type":28,"tag":178,"props":458,"children":460},{"className":180,"code":459,"language":182,"meta":7,"style":7},"git config --global core.excludesfile ~/.gitignore_global\n",[461],{"type":28,"tag":159,"props":462,"children":463},{"__ignoreMap":7},[464],{"type":28,"tag":188,"props":465,"children":466},{"class":190,"line":191},[467,471,475,479,484],{"type":28,"tag":188,"props":468,"children":469},{"style":195},[470],{"type":37,"value":198},{"type":28,"tag":188,"props":472,"children":473},{"style":201},[474],{"type":37,"value":204},{"type":28,"tag":188,"props":476,"children":477},{"style":201},[478],{"type":37,"value":209},{"type":28,"tag":188,"props":480,"children":481},{"style":201},[482],{"type":37,"value":483}," core.excludesfile",{"type":28,"tag":188,"props":485,"children":486},{"style":201},[487],{"type":37,"value":488}," ~/.gitignore_global\n",{"type":28,"tag":57,"props":490,"children":491},{},[492],{"type":28,"tag":61,"props":493,"children":494},{},[495,497,504],{"type":37,"value":496},"This ",{"type":28,"tag":167,"props":498,"children":501},{"href":499,"rel":500},"https://www.gitignore.io",[171],[502],{"type":37,"value":503},"site",{"type":37,"value":505}," give you recommendations on what to ignore based on your system & IDE...",{"type":28,"tag":77,"props":507,"children":509},{"id":508},"_2-git-branches",[510],{"type":37,"value":511},"2- Git branches",{"type":28,"tag":57,"props":513,"children":514},{},[515,520,525],{"type":28,"tag":61,"props":516,"children":517},{},[518],{"type":37,"value":519},"One of the powerful features of git is branches: you can think of them as a sequence of commits and the branch have a movable pointer, the sequence grows and the pointer moves forward with each commit.",{"type":28,"tag":61,"props":521,"children":522},{},[523],{"type":37,"value":524},"Every commit (circle) represents a snapshot of your project, at the time of the commit.",{"type":28,"tag":61,"props":526,"children":527},{},[528],{"type":37,"value":529},"Branches allow you to develop features, fix bugs, or safely experiment with new ideas in a contained area of your repository.",{"type":28,"tag":531,"props":532,"children":538},"img",{"load":533,"src":534,"alt":535,"className":536},"lazy","/blog/git branches.png","git branches picture",[537],"draw",[],{"type":28,"tag":57,"props":540,"children":541},{},[542,547,552],{"type":28,"tag":61,"props":543,"children":544},{},[545],{"type":37,"value":546},"The diagram above visualizes a repository with two isolated lines of development, one for a little feature, and one for a longer-running feature. By developing them in branches, it’s not only possible to work on both of them in parallel, but it also keeps the main branch free from questionable code.",{"type":28,"tag":61,"props":548,"children":549},{},[550],{"type":37,"value":551},"Ps: GitHub (and the industry at large) is moving to rename the default branch as main instead of master.",{"type":28,"tag":61,"props":553,"children":554},{},[555],{"type":37,"value":556},"Here are useful commands to work with branches:",{"type":28,"tag":178,"props":558,"children":560},{"className":180,"code":559,"language":182,"meta":7,"style":7},"# list all the branches in a project\ngit branch\n# create a new branch with name test without checking out\ngit branch test\n# delete the test branch if it has merged changes\ngit branch -d test\n# Force delete even if test has unmerged changes\ngit branch -D test\n# rename the current branch to test\ngit branch -m test\n# list all the remote branches\ngit branch -a\n# checkout to the branch test\ngit checkout test\n",[561],{"type":28,"tag":159,"props":562,"children":563},{"__ignoreMap":7},[564,572,584,592,609,617,637,645,665,673,693,702,719,728],{"type":28,"tag":188,"props":565,"children":566},{"class":190,"line":191},[567],{"type":28,"tag":188,"props":568,"children":569},{"style":222},[570],{"type":37,"value":571},"# list all the branches in a project\n",{"type":28,"tag":188,"props":573,"children":574},{"class":190,"line":228},[575,579],{"type":28,"tag":188,"props":576,"children":577},{"style":195},[578],{"type":37,"value":198},{"type":28,"tag":188,"props":580,"children":581},{"style":201},[582],{"type":37,"value":583}," branch\n",{"type":28,"tag":188,"props":585,"children":586},{"class":190,"line":314},[587],{"type":28,"tag":188,"props":588,"children":589},{"style":222},[590],{"type":37,"value":591},"# create a new branch with name test without checking out\n",{"type":28,"tag":188,"props":593,"children":594},{"class":190,"line":323},[595,599,604],{"type":28,"tag":188,"props":596,"children":597},{"style":195},[598],{"type":37,"value":198},{"type":28,"tag":188,"props":600,"children":601},{"style":201},[602],{"type":37,"value":603}," branch",{"type":28,"tag":188,"props":605,"children":606},{"style":201},[607],{"type":37,"value":608}," test\n",{"type":28,"tag":188,"props":610,"children":611},{"class":190,"line":341},[612],{"type":28,"tag":188,"props":613,"children":614},{"style":222},[615],{"type":37,"value":616},"# delete the test branch if it has merged changes\n",{"type":28,"tag":188,"props":618,"children":619},{"class":190,"line":375},[620,624,628,633],{"type":28,"tag":188,"props":621,"children":622},{"style":195},[623],{"type":37,"value":198},{"type":28,"tag":188,"props":625,"children":626},{"style":201},[627],{"type":37,"value":603},{"type":28,"tag":188,"props":629,"children":630},{"style":201},[631],{"type":37,"value":632}," -d",{"type":28,"tag":188,"props":634,"children":635},{"style":201},[636],{"type":37,"value":608},{"type":28,"tag":188,"props":638,"children":639},{"class":190,"line":384},[640],{"type":28,"tag":188,"props":641,"children":642},{"style":222},[643],{"type":37,"value":644},"# Force delete even if test has unmerged changes\n",{"type":28,"tag":188,"props":646,"children":647},{"class":190,"line":411},[648,652,656,661],{"type":28,"tag":188,"props":649,"children":650},{"style":195},[651],{"type":37,"value":198},{"type":28,"tag":188,"props":653,"children":654},{"style":201},[655],{"type":37,"value":603},{"type":28,"tag":188,"props":657,"children":658},{"style":201},[659],{"type":37,"value":660}," -D",{"type":28,"tag":188,"props":662,"children":663},{"style":201},[664],{"type":37,"value":608},{"type":28,"tag":188,"props":666,"children":667},{"class":190,"line":420},[668],{"type":28,"tag":188,"props":669,"children":670},{"style":222},[671],{"type":37,"value":672},"# rename the current branch to test\n",{"type":28,"tag":188,"props":674,"children":676},{"class":190,"line":675},10,[677,681,685,689],{"type":28,"tag":188,"props":678,"children":679},{"style":195},[680],{"type":37,"value":198},{"type":28,"tag":188,"props":682,"children":683},{"style":201},[684],{"type":37,"value":603},{"type":28,"tag":188,"props":686,"children":687},{"style":201},[688],{"type":37,"value":356},{"type":28,"tag":188,"props":690,"children":691},{"style":201},[692],{"type":37,"value":608},{"type":28,"tag":188,"props":694,"children":696},{"class":190,"line":695},11,[697],{"type":28,"tag":188,"props":698,"children":699},{"style":222},[700],{"type":37,"value":701},"# list all the remote branches\n",{"type":28,"tag":188,"props":703,"children":705},{"class":190,"line":704},12,[706,710,714],{"type":28,"tag":188,"props":707,"children":708},{"style":195},[709],{"type":37,"value":198},{"type":28,"tag":188,"props":711,"children":712},{"style":201},[713],{"type":37,"value":603},{"type":28,"tag":188,"props":715,"children":716},{"style":201},[717],{"type":37,"value":718}," -a\n",{"type":28,"tag":188,"props":720,"children":722},{"class":190,"line":721},13,[723],{"type":28,"tag":188,"props":724,"children":725},{"style":222},[726],{"type":37,"value":727},"# checkout to the branch test\n",{"type":28,"tag":188,"props":729,"children":731},{"class":190,"line":730},14,[732,736,741],{"type":28,"tag":188,"props":733,"children":734},{"style":195},[735],{"type":37,"value":198},{"type":28,"tag":188,"props":737,"children":738},{"style":201},[739],{"type":37,"value":740}," checkout",{"type":28,"tag":188,"props":742,"children":743},{"style":201},[744],{"type":37,"value":608},{"type":28,"tag":57,"props":746,"children":747},{},[748],{"type":28,"tag":61,"props":749,"children":750},{},[751],{"type":37,"value":752},"When you create a new branch, git only creates another pointer to the last commit, you need to checkout to the branch and add new code and commit.",{"type":28,"tag":77,"props":754,"children":756},{"id":755},"_3-revert-to-previous",[757],{"type":37,"value":758},"3- Revert to previous",{"type":28,"tag":57,"props":760,"children":761},{},[762,767,805],{"type":28,"tag":61,"props":763,"children":764},{},[765],{"type":37,"value":766},"So you committed changes, just to realize that you screwed up, how to fix it now?",{"type":28,"tag":61,"props":768,"children":769},{},[770,772],{"type":37,"value":771},"You can either reset:\n",{"type":28,"tag":57,"props":773,"children":774},{},[775,785,795],{"type":28,"tag":61,"props":776,"children":777},{},[778,780],{"type":37,"value":779},"Affect only the remote repo, not the local one: ",{"type":28,"tag":159,"props":781,"children":782},{"className":7},[783],{"type":37,"value":784},"git reset --soft HEAD~1",{"type":28,"tag":61,"props":786,"children":787},{},[788,790],{"type":37,"value":789},"The most direct, dangerous, and frequently used option. When passed --hard The Commit History ref pointers are updated to the specified commit: ",{"type":28,"tag":159,"props":791,"children":792},{"className":7},[793],{"type":37,"value":794},"git reset --hard HEAD~1",{"type":28,"tag":61,"props":796,"children":797},{},[798,800],{"type":37,"value":799},"This is the default operating mode. The ref pointers are updated. The Staging Index is reset to the state of the specified commit: ",{"type":28,"tag":159,"props":801,"children":802},{"className":7},[803],{"type":37,"value":804},"git reset --mixed HEAD~1",{"type":28,"tag":61,"props":806,"children":807},{},[808,810,815],{"type":37,"value":809},"Or you can revert: ",{"type":28,"tag":159,"props":811,"children":812},{"className":7},[813],{"type":37,"value":814},"git revert HEAD~3",{"type":37,"value":816}," (Revert the changes specified by the fourth last commit in HEAD and create a new commit with the reverted changes).",{"type":28,"tag":29,"props":818,"children":819},{},[820],{"type":37,"value":821},"💡 Remove not commited changes from a branch and add them to a new one:",{"type":28,"tag":178,"props":823,"children":825},{"className":180,"code":824,"language":182,"meta":7,"style":7},"git stash\ngit checkout -b new-branch\ngit stash popl\n",[826],{"type":28,"tag":159,"props":827,"children":828},{"__ignoreMap":7},[829,841,861],{"type":28,"tag":188,"props":830,"children":831},{"class":190,"line":191},[832,836],{"type":28,"tag":188,"props":833,"children":834},{"style":195},[835],{"type":37,"value":198},{"type":28,"tag":188,"props":837,"children":838},{"style":201},[839],{"type":37,"value":840}," stash\n",{"type":28,"tag":188,"props":842,"children":843},{"class":190,"line":228},[844,848,852,856],{"type":28,"tag":188,"props":845,"children":846},{"style":195},[847],{"type":37,"value":198},{"type":28,"tag":188,"props":849,"children":850},{"style":201},[851],{"type":37,"value":740},{"type":28,"tag":188,"props":853,"children":854},{"style":201},[855],{"type":37,"value":306},{"type":28,"tag":188,"props":857,"children":858},{"style":201},[859],{"type":37,"value":860}," new-branch\n",{"type":28,"tag":188,"props":862,"children":863},{"class":190,"line":314},[864,868,873],{"type":28,"tag":188,"props":865,"children":866},{"style":195},[867],{"type":37,"value":198},{"type":28,"tag":188,"props":869,"children":870},{"style":201},[871],{"type":37,"value":872}," stash",{"type":28,"tag":188,"props":874,"children":875},{"style":201},[876],{"type":37,"value":877}," popl\n",{"type":28,"tag":77,"props":879,"children":881},{"id":880},"_4-contribute",[882],{"type":37,"value":883},"4- Contribute",{"type":28,"tag":57,"props":885,"children":886},{},[887],{"type":28,"tag":61,"props":888,"children":889},{},[890],{"type":37,"value":891},"You want to create a local copy of an opensource project from Github:",{"type":28,"tag":178,"props":893,"children":895},{"className":180,"code":894,"language":182,"meta":7,"style":7},"# replace with the actual repo link\ngit clone https://github.com/user/repo.git\n",[896],{"type":28,"tag":159,"props":897,"children":898},{"__ignoreMap":7},[899,907],{"type":28,"tag":188,"props":900,"children":901},{"class":190,"line":191},[902],{"type":28,"tag":188,"props":903,"children":904},{"style":222},[905],{"type":37,"value":906},"# replace with the actual repo link\n",{"type":28,"tag":188,"props":908,"children":909},{"class":190,"line":228},[910,914,919],{"type":28,"tag":188,"props":911,"children":912},{"style":195},[913],{"type":37,"value":198},{"type":28,"tag":188,"props":915,"children":916},{"style":201},[917],{"type":37,"value":918}," clone",{"type":28,"tag":188,"props":920,"children":921},{"style":201},[922],{"type":37,"value":408},{"type":28,"tag":57,"props":924,"children":925},{},[926],{"type":28,"tag":61,"props":927,"children":928},{},[929,931,936,938,943,945,950,952,957,958,963],{"type":37,"value":930},"You want to contribute to a project: - Find a project worth working on. - Fork it and clone it with ",{"type":28,"tag":159,"props":932,"children":933},{"className":7},[934],{"type":37,"value":935},"git clone",{"type":37,"value":937},". - Open the project in your favourite IDE & create a new branch with ",{"type":28,"tag":159,"props":939,"children":940},{"className":7},[941],{"type":37,"value":942},"git checkout -b NewBranch",{"type":37,"value":944},". - Make the changes to the project, then ",{"type":28,"tag":159,"props":946,"children":947},{"className":7},[948],{"type":37,"value":949},"git add",{"type":37,"value":951}," & ",{"type":28,"tag":159,"props":953,"children":954},{"className":7},[955],{"type":37,"value":956},"git commit -m \"message\"",{"type":37,"value":951},{"type":28,"tag":159,"props":959,"children":960},{"className":7},[961],{"type":37,"value":962},"git push origin NewBranch",{"type":37,"value":964},". - Now go the remote repository and open a pull request , github will automatically detect if merging your new branch to the main one will cause any conflicts. - Wait for the admin code review, if approved cool 🎉 congratulations, if not refactor you code & repeat :)",{"type":28,"tag":77,"props":966,"children":968},{"id":967},"_5-final-notes",[969],{"type":37,"value":970},"5. Final notes",{"type":28,"tag":57,"props":972,"children":973},{},[974],{"type":28,"tag":61,"props":975,"children":976},{},[977],{"type":37,"value":978},"You want to visualize your commits history:",{"type":28,"tag":178,"props":980,"children":982},{"className":180,"code":981,"language":182,"meta":7,"style":7},"git log\n",[983],{"type":28,"tag":159,"props":984,"children":985},{"__ignoreMap":7},[986],{"type":28,"tag":188,"props":987,"children":988},{"class":190,"line":191},[989,993],{"type":28,"tag":188,"props":990,"children":991},{"style":195},[992],{"type":37,"value":198},{"type":28,"tag":188,"props":994,"children":995},{"style":201},[996],{"type":37,"value":997}," log\n",{"type":28,"tag":57,"props":999,"children":1000},{},[1001,1006],{"type":28,"tag":61,"props":1002,"children":1003},{},[1004],{"type":37,"value":1005},"Git has become an industry standard today, and while this article is not an in-depth tutorial about the system, I hope it gets you starting, and don't forget to check the external links and do your own research and experiment!",{"type":28,"tag":61,"props":1007,"children":1008},{},[1009,1011],{"type":37,"value":1010},"This was a very quick introduction about branches, to learn about them in detail please visit: ",{"type":28,"tag":167,"props":1012,"children":1015},{"href":1013,"rel":1014},"https://learngitbranching.js.org/",[171],[1016],{"type":37,"value":1013},{"type":28,"tag":1018,"props":1019,"children":1020},"style",{},[1021],{"type":37,"value":1022},"html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":228,"depth":228,"links":1024},[1025,1026,1027,1028,1029,1030],{"id":79,"depth":228,"text":82},{"id":146,"depth":228,"text":149},{"id":508,"depth":228,"text":511},{"id":755,"depth":228,"text":758},{"id":880,"depth":228,"text":883},{"id":967,"depth":228,"text":970},"markdown","content:blog:git.md","content","blog/git.md","md",1708620390897]