[{"data":1,"prerenderedAt":293},["ShallowReactive",2],{"blog-github":3},{"id":4,"title":5,"body":6,"date":278,"description":279,"draft":280,"extension":281,"image":282,"meta":283,"navigation":284,"path":285,"seo":286,"stem":287,"tags":288,"__hash__":292},"blogs\u002Fblogs\u002Fgithub\u002Findex.md","Git and GitHub- Basic commands for beginners",{"type":7,"value":8,"toc":268},"minimark",[9,13,18,21,44,48,78,82,85,107,111,114,158,162,165,172,183,224,229,236,240,246,249,254,257,261,264],[10,11,12],"p",{},"Git and GitHub have become indispensable tools for developers and teams working on software projects. Git is a distributed version control system, and GitHub is a web-based platform that enhances collaboration and code sharing. In this blog, we'll focus on four fundamental Git commands that every developer should know and expand on other essential topics related to Git and GitHub.",[14,15,17],"h3",{"id":16},"_1-git-initialization-git-init","1. Git Initialization ( git init )",[10,19,20],{},"To start version controlling your project with Git, you first need to initialize a repository. The git init command creates a new Git repository in your project directory. It establishes a .git directory that tracks changes and manages your project's history.",[22,23,28],"pre",{"className":24,"code":25,"language":26,"meta":27,"style":27},"language-bash shiki shiki-themes github-light","git init\n","bash","",[29,30,31],"code",{"__ignoreMap":27},[32,33,36,40],"span",{"class":34,"line":35},"line",1,[32,37,39],{"class":38},"s7eDp","git",[32,41,43],{"class":42},"sYBdl"," init\n",[14,45,47],{"id":46},"_2-adding-and-committing-git-add-and-git-commit","2. Adding and Committing ( git add and git commit )",[22,49,51],{"className":24,"code":50,"language":26,"meta":27,"style":27},"git add .\ngit commit -m \"Your message here\"\n",[29,52,53,63],{"__ignoreMap":27},[32,54,55,57,60],{"class":34,"line":35},[32,56,39],{"class":38},[32,58,59],{"class":42}," add",[32,61,62],{"class":42}," .\n",[32,64,66,68,71,75],{"class":34,"line":65},2,[32,67,39],{"class":38},[32,69,70],{"class":42}," commit",[32,72,74],{"class":73},"sYu0t"," -m",[32,76,77],{"class":42}," \"Your message here\"\n",[14,79,81],{"id":80},"_3-managing-branches-git-branch","3. Managing Branches (git branch)",[10,83,84],{},"Branches are a vital part of Git workflows. They allow you to work on different features or bug fixes without affecting the main codebase. Use git branch to list existing branches and create new ones.",[22,86,88],{"className":24,"code":87,"language":26,"meta":27,"style":27},"git branch\ngit branch feature-branch\n",[29,89,90,97],{"__ignoreMap":27},[32,91,92,94],{"class":34,"line":35},[32,93,39],{"class":38},[32,95,96],{"class":42}," branch\n",[32,98,99,101,104],{"class":34,"line":65},[32,100,39],{"class":38},[32,102,103],{"class":42}," branch",[32,105,106],{"class":42}," feature-branch\n",[14,108,110],{"id":109},"_4-remote-repositories-git-remote","4. Remote Repositories (git remote)",[10,112,113],{},"Git allows you to collaborate with others by connecting your local repository to remote repositories, such as GitHub. The git remote command helps you manage remote connections.",[22,115,117],{"className":24,"code":116,"language":26,"meta":27,"style":27},"git remote\ngit remote add origin \u003CGitHub repository URL>\n",[29,118,119,126],{"__ignoreMap":27},[32,120,121,123],{"class":34,"line":35},[32,122,39],{"class":38},[32,124,125],{"class":42}," remote\n",[32,127,128,130,133,135,138,142,145,148,151,155],{"class":34,"line":65},[32,129,39],{"class":38},[32,131,132],{"class":42}," remote",[32,134,59],{"class":42},[32,136,137],{"class":42}," origin",[32,139,141],{"class":140},"sD7c4"," \u003C",[32,143,144],{"class":42},"GitHub",[32,146,147],{"class":42}," repository",[32,149,150],{"class":42}," UR",[32,152,154],{"class":153},"sgsFI","L",[32,156,157],{"class":140},">\n",[14,159,161],{"id":160},"beyond-the-basics","Beyond the Basics",[10,163,164],{},"While these four commands are fundamental, Git and GitHub offer much more:",[166,167,168],"ol",{},[169,170,171],"li",{},"Pushing and Pulling (git push and git pull)",[10,173,174,175,178,179,182],{},"Use ",[29,176,177],{},"git push"," to send your local commits to a remote repository, and ",[29,180,181],{},"git pull"," to retrieve changes from a remote repository to your local project.",[22,184,186],{"className":24,"code":185,"language":26,"meta":27,"style":27},"git push origin \u003Cbranch-name>\ngit pull origin \u003Cbranch-name>\n",[29,187,188,207],{"__ignoreMap":27},[32,189,190,192,195,197,199,202,205],{"class":34,"line":35},[32,191,39],{"class":38},[32,193,194],{"class":42}," push",[32,196,137],{"class":42},[32,198,141],{"class":140},[32,200,201],{"class":42},"branch-nam",[32,203,204],{"class":153},"e",[32,206,157],{"class":140},[32,208,209,211,214,216,218,220,222],{"class":34,"line":65},[32,210,39],{"class":38},[32,212,213],{"class":42}," pull",[32,215,137],{"class":42},[32,217,141],{"class":140},[32,219,201],{"class":42},[32,221,204],{"class":153},[32,223,157],{"class":140},[166,225,226],{"start":65},[169,227,228],{},"Cloning Repositories (git clone)",[10,230,231,232,235],{},"To create a local copy of a remote repository, use the ",[29,233,234],{},"git clone"," command. This is useful when starting to work on an existing project hosted on GitHub.",[14,237,239],{"id":238},"authenticate-your-github-account-with-git-on-your-local-machine-to-work-seamlessly","Authenticate your Github account with git on your local machine to work seamlessly",[241,242,243],"ul",{},[169,244,245],{},"Github CLI tool",[10,247,248],{},"GitHub provides a command-line interface (CLI) tool that streamlines interactions with GitHub repositories and issues. It offers features like creating repositories, managing issues, and more.",[241,250,251],{},[169,252,253],{},"SSH Key Authentication",[10,255,256],{},"To enhance security and simplify access to your GitHub repositories, consider setting up SSH key authentication. This allows you to securely connect to your repositories without entering your credentials repeatedly.",[14,258,260],{"id":259},"conclusion","Conclusion",[10,262,263],{},"Mastering these essential Git and GitHub commands will empower you to efficiently track changes, collaborate with others, and manage your projects effectively. Git and GitHub offer a plethora of features and capabilities that can greatly enhance your development workflow, making them invaluable tools for any software developer or team. Explore and experiment with these tools to harness their full potential.",[265,266,267],"style",{},"html pre.shiki code .s7eDp, html code.shiki .s7eDp{--shiki-default:#6F42C1}html pre.shiki code .sYBdl, html code.shiki .sYBdl{--shiki-default:#032F62}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);}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 pre.shiki code .sYu0t, html code.shiki .sYu0t{--shiki-default:#005CC5}html pre.shiki code .sD7c4, html code.shiki .sD7c4{--shiki-default:#D73A49}html pre.shiki code .sgsFI, html code.shiki .sgsFI{--shiki-default:#24292E}",{"title":27,"searchDepth":65,"depth":65,"links":269},[270,272,273,274,275,276,277],{"id":16,"depth":271,"text":17},3,{"id":46,"depth":271,"text":47},{"id":80,"depth":271,"text":81},{"id":109,"depth":271,"text":110},{"id":160,"depth":271,"text":161},{"id":238,"depth":271,"text":239},{"id":259,"depth":271,"text":260},"2023-10-27","Not a complete course for Git just basic 5 to 6 commands which i use every day",false,"md",null,{},true,"\u002Fblogs\u002Fgithub",{"title":5,"description":279},"blogs\u002Fgithub\u002Findex",[289,290,39,291],"programming language","computer science","github","cfC_3rXg2P-MQrk6lktnPs0o7Q8xr92QbxLqw8JHqco",1782753863908]