{"id":7889,"date":"2024-02-28T08:05:04","date_gmt":"2024-02-28T08:05:04","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=7889"},"modified":"2024-02-28T08:05:06","modified_gmt":"2024-02-28T08:05:06","slug":"beginners-guide-git-essential-commands-usage","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/","title":{"rendered":"Guide to Git essential Commands and usage"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/git_guide_en.jpg\" alt=\"Git Essential Commands lines and Usage Install Windows , Ubuntu Debian\" class=\"wp-image-7898\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/git_guide_en.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/git_guide_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/git_guide_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/git_guide_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/git_guide_en-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p><strong>Git<\/strong> is a distributed version control system that allows teams of developers to efficiently collaborate on code. With Git, you can track changes to your project over time, easily collaborate with others, and merge code changes from multiple developers.<\/p>\n\n\n\n<p>As a beginner, it&#8217;s important to learn some essential Git commands and workflows to start using version control effectively. This guide will walk through the basic Git commands and processes step-by-step to help you get started with Git and version control.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"setting-up-git\">Setting Up Git<\/h2>\n\n\n\n<p>To start using Git, you need to install it on your computer first. Here&#8217;s how to get set up:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-git\">Install Git<\/h3>\n\n\n\n<ul>\n<li>On Linux\/Unix: Git usually comes pre-installed with most Linux distributions. To confirm, open a terminal and type&nbsp;<code>git --version<\/code>&nbsp;to check if Git is installed. If not, use your distro&#8217;s package manager to install it (e.g.&nbsp;<code>apt-get install git<\/code>&nbsp;on Ubuntu\/Debian).<\/li>\n\n\n\n<li>On Mac: Install Git via Homebrew with&nbsp;<code>brew install git<\/code>, or download the installer from&nbsp;<a href=\"https:\/\/git-scm.com\/download\/mac\">git-scm.com<\/a>.<\/li>\n\n\n\n<li>On Windows: Download and run the Git installer from&nbsp;<a href=\"https:\/\/git-scm.com\/download\/win\">git-scm.com<\/a>. Select your options during the installation process.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"configure-git\">Configure Git<\/h3>\n\n\n\n<p>Once Git is installed, you need to configure your name and email to identify your commits:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git config --global user.name \"Your Name\"\n$ git config --global user.email \"your.email@example.com\"<\/code><\/pre>\n\n\n\n<p>This links your Git activity to your identity. The&nbsp;<code>--global<\/code>&nbsp;flag sets this username\/email for all Git repositories on your system.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"generate-ssh-keys-optional\">Generate SSH keys (optional)<\/h3>\n\n\n\n<p>If you plan to connect to remote Git repositories over SSH, you need to generate SSH keys. This allows you to push to repos without entering your password every time.<\/p>\n\n\n\n<p>To generate keys:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ssh-keygen -t rsa -b 4096 -C \"your.email@example.com\"<\/code><\/pre>\n\n\n\n<p>This will create a public and private SSH key pair. You can then add your public key to services like GitHub to connect over SSH.<\/p>\n\n\n\n<p>You&#8217;re now ready to start using Git! Let&#8217;s go over some core concepts and commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"git-concepts\">Git Concepts<\/h2>\n\n\n\n<p>Before learning Git commands, it&#8217;s important to understand some key concepts in Git:<\/p>\n\n\n\n<ul>\n<li><strong>Repository<\/strong>: A repository (or repo) contains the entire collection of files and folders associated with a project, along with each file&#8217;s revision history.<\/li>\n\n\n\n<li><strong>Commit<\/strong>: A commit is a snapshot of your repo at a particular point in time. Commits capture the changes you make to the code.<\/li>\n\n\n\n<li><strong>Branch<\/strong>: A branch represents an independent line of development. By default, every repo has a main branch (typically called master) that serves as the definitive branch.<\/li>\n\n\n\n<li><strong>Merge<\/strong>: A merge combines changes from one branch into another, e.g. merging feature branch changes into main.<\/li>\n\n\n\n<li><strong>Remote<\/strong>: A remote repo is one hosted on the internet or network. It allows collaborators to push and pull changes.<\/li>\n\n\n\n<li><strong>Clone<\/strong>: Cloning downloads a remote repo to your local machine so you can work on it.<\/li>\n<\/ul>\n\n\n\n<p>These concepts enable powerful collaboration workflows in Git. Keep them in mind as we run through essential commands.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"git-commands\">Git Commands<\/h2>\n\n\n\n<p>Now let&#8217;s dive into the basic Git commands and workflows you&#8217;ll use in daily development.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-init\">git init<\/h3>\n\n\n\n<p>Initializes a new Git repo in the current directory. This turns a regular directory into a Git project where you can start tracking changes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git init<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-status\">git status<\/h3>\n\n\n\n<p>Checks the status of the repo and displays files that are untracked, modified, staged, etc. Extremely useful command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git status<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-add\">git add<\/h3>\n\n\n\n<p>Adds files changes in your working directory to the staging area to be included in the next commit. Call git add on specific files or directories like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git add file.txt\n$ git add folder\/ <\/code><\/pre>\n\n\n\n<p>To add all changed files, use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git add .<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-commit\">git commit<\/h3>\n\n\n\n<p>Commits the staged snapshot to the project history. Committed snapshots can be thought of as &#8220;save points&#8221; that you can revert to later.<\/p>\n\n\n\n<p>Always write a descriptive commit message:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git commit -m \"Your descriptive commit message\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-log\">git log<\/h3>\n\n\n\n<p>Shows the commit history with author name, date, and commit message. Useful for viewing project history and finding old commits:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git log<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-checkout\">git checkout<\/h3>\n\n\n\n<p>Checkout switches between branches in a repo. To start working on a new branch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git checkout -b branch-name<\/code><\/pre>\n\n\n\n<p>To switch to an existing branch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git checkout branch-name<\/code><\/pre>\n\n\n\n<p>And to switch back to main:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git checkout main<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-merge\">git merge<\/h3>\n\n\n\n<p>Merges changes from one branch into your current branch (e.g. merging feature changes into main).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git merge branch-to-merge<\/code><\/pre>\n\n\n\n<p>This performs the merge. Git will auto-merge changes if there are no major conflicts between the branches.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-remote\">git remote<\/h3>\n\n\n\n<p>Manages connections to remote repositories. You&#8217;ll need to add a remote to push your repo to a hosted service like GitHub:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git remote add origin https:\/\/github.com\/user\/repo.git<\/code><\/pre>\n\n\n\n<p>Verify your remote connections using:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git remote -v<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-push\">git push<\/h3>\n\n\n\n<p>Pushes local repo commits to the remote repo specified. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git push origin main<\/code><\/pre>\n\n\n\n<p>This pushes your local main branch to the origin remote&#8217;s main branch.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-pull\">git pull<\/h3>\n\n\n\n<p>Pulls in changes from a remote repo to your local repo. Fetches changes from the remote first then merges them to your local branch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git pull origin main<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"git-clone\">git clone<\/h3>\n\n\n\n<p>Clones a remote repo to create a local working copy. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git clone https:\/\/github.com\/user\/repo.git<\/code><\/pre>\n\n\n\n<p>This downloads the remote repo to your machine so you can work locally.<\/p>\n\n\n\n<p>Those are the key Git commands and workflows to get started with version control. Some other useful commands include:<\/p>\n\n\n\n<ul>\n<li><code>git diff<\/code>&nbsp;to view changes between commits, branches, working directory vs repo, etc.<\/li>\n\n\n\n<li><code>git reset<\/code>&nbsp;to undo local changes and revert repo state<\/li>\n\n\n\n<li><code>git rebase<\/code>&nbsp;to rebase your commits onto another branch<\/li>\n<\/ul>\n\n\n\n<p>And many more! The&nbsp;<a href=\"https:\/\/git-scm.com\/docs\">Git documentation<\/a>&nbsp;provides a detailed reference for additional commands.<\/p>\n\n\n\n<p>Now let&#8217;s walk through a simple collaborative Git workflow&#8230;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"collaborative-git-workflow-example\">Collaborative Git Workflow Example<\/h2>\n\n\n\n<p>Here&#8217;s an example workflow for collaboratively developing a project with a remote Git repository and multiple contributors:<\/p>\n\n\n\n<ol>\n<li>Initialize Git in a new project folder:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git init<\/code><\/pre>\n\n\n\n<ol start=\"2\">\n<li>Create the remote repository on GitHub<\/li>\n\n\n\n<li>Connect local repository to remote:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git remote add origin https:\/\/github.com\/user\/repo.git<\/code><\/pre>\n\n\n\n<ol start=\"4\">\n<li>Create a new feature branch locally:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git checkout -b new-feature<\/code><\/pre>\n\n\n\n<ol start=\"5\">\n<li>Make changes, stage, and commit locally:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git add .\n$ git commit -m \"Add new feature\"<\/code><\/pre>\n\n\n\n<ol start=\"6\">\n<li>Fetch latest remote changes:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git fetch<\/code><\/pre>\n\n\n\n<ol start=\"7\">\n<li>Merge remote main branch into your feature branch:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git merge origin\/main<\/code><\/pre>\n\n\n\n<ol start=\"8\">\n<li>Push feature branch to remote:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git push origin new-feature<\/code><\/pre>\n\n\n\n<ol start=\"9\">\n<li>On GitHub, create a pull request to merge new-feature into main<\/li>\n\n\n\n<li>Review code, approve, and merge pull request on GitHub<\/li>\n\n\n\n<li>Pull remote main into local repository:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git pull origin main<\/code><\/pre>\n\n\n\n<ol start=\"12\">\n<li>Checkout main branch locally:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ git checkout main<\/code><\/pre>\n\n\n\n<p>Your colleague&#8217;s changes are now fetched into your local main branch.<\/p>\n\n\n\n<p>This shows a complete collaborative workflow:<\/p>\n\n\n\n<ul>\n<li>Forking a feature branch locally<\/li>\n\n\n\n<li>Pushing to remote<\/li>\n\n\n\n<li>Creating a PR to merge into main<\/li>\n\n\n\n<li>Fetching latest main into local repo<\/li>\n<\/ul>\n\n\n\n<p>By leveraging branches, commits, merges, and remotes, you can collaborate efficiently on code!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Those are the key Git commands and workflows to get you started with version control for your projects and code. Here are some additional tips:<\/p>\n\n\n\n<ul>\n<li>Commit regularly with descriptive messages<\/li>\n\n\n\n<li>Keep your main branch stable by doing feature work in branches<\/li>\n\n\n\n<li>Sync your local repo often with remote to get latest changes<\/li>\n\n\n\n<li>Leverage pull requests\/merge requests for peer reviews<\/li>\n\n\n\n<li>Use&nbsp;<code>git log<\/code>&nbsp;and&nbsp;<code>git diff<\/code>&nbsp;to inspect changes<\/li>\n<\/ul>\n\n\n\n<p>Git enables powerful collaboration and version control for projects. Learning its basic commands gets you up and running managing code with Git. The&nbsp;<a href=\"https:\/\/git-scm.com\/doc\">Git documentation<\/a>&nbsp;provides more details on advanced workflows.<\/p>\n\n\n\n<p>With these essentials, you now have the key tools to start version controlling your code!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Git is a distributed version control system that allows teams of developers to efficiently collaborate on code. With Git, you can track changes to your project over time, easily collaborate with others, and merge code changes from multiple developers. As a beginner, it&#8217;s important to learn some essential Git commands and workflows to start using ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[188,69],"tags":[],"yoast_head":"\n<title>Guide to Git essential Commands and usage - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"A comprehensive guide to essential Git commands and workflows for software developers. Covers Git setup, basic commands like commit, push, pull, branching, and collaborating on code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Guide to Git essential Commands and usage - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"A comprehensive guide to essential Git commands and workflows for software developers. Covers Git setup, basic commands like commit, push, pull, branching, and collaborating on code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-28T08:05:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-28T08:05:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/git_guide_en.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"Guide to Git essential Commands and usage\",\"datePublished\":\"2024-02-28T08:05:04+00:00\",\"dateModified\":\"2024-02-28T08:05:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/\"},\"wordCount\":1126,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"CMS &amp; Web development\",\"Linux system administration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/\",\"name\":\"Guide to Git essential Commands and usage - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2024-02-28T08:05:04+00:00\",\"dateModified\":\"2024-02-28T08:05:06+00:00\",\"description\":\"A comprehensive guide to essential Git commands and workflows for software developers. Covers Git setup, basic commands like commit, push, pull, branching, and collaborating on code.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Guide to Git essential Commands and usage\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781819544\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781819544\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"Guide to Git essential Commands and usage - WebHi Tutorials &amp; Documentations","description":"A comprehensive guide to essential Git commands and workflows for software developers. Covers Git setup, basic commands like commit, push, pull, branching, and collaborating on code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/","og_locale":"en_US","og_type":"article","og_title":"Guide to Git essential Commands and usage - WebHi Tutorials &amp; Documentations","og_description":"A comprehensive guide to essential Git commands and workflows for software developers. Covers Git setup, basic commands like commit, push, pull, branching, and collaborating on code.","og_url":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2024-02-28T08:05:04+00:00","article_modified_time":"2024-02-28T08:05:06+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/git_guide_en.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"Guide to Git essential Commands and usage","datePublished":"2024-02-28T08:05:04+00:00","dateModified":"2024-02-28T08:05:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/"},"wordCount":1126,"commentCount":0,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["CMS &amp; Web development","Linux system administration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/","url":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/","name":"Guide to Git essential Commands and usage - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2024-02-28T08:05:04+00:00","dateModified":"2024-02-28T08:05:06+00:00","description":"A comprehensive guide to essential Git commands and workflows for software developers. Covers Git setup, basic commands like commit, push, pull, branching, and collaborating on code.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/beginners-guide-git-essential-commands-usage\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"Guide to Git essential Commands and usage"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781819544","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1781819544","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/7889"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=7889"}],"version-history":[{"count":6,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/7889\/revisions"}],"predecessor-version":[{"id":7914,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/7889\/revisions\/7914"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=7889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=7889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=7889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}