{"id":7403,"date":"2022-09-08T13:07:47","date_gmt":"2022-09-08T07:37:47","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=7403"},"modified":"2022-09-08T13:07:47","modified_gmt":"2022-09-08T07:37:47","slug":"git-session","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/git-session\/","title":{"rendered":"Git Session"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone  wp-image-7404\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/b1-300x213.png\" alt=\"\" width=\"459\" height=\"326\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/b1-300x213.png 300w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/b1-624x443.png 624w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/b1.png 769w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/p>\n<ul>\n<li>\u201cgit add .\u201d : is a command used to add a file that is in the working directory to the staging area.<\/li>\n<li>\u201cgit commit\u201d: is a command used to add all files that are staged to the local repository.<\/li>\n<li>\u201cgit push\u201d: is a command used to add all committed files in the local repository to the remote repository. So in the remote repository, all files and changes will be visible to anyone with access to the remote repository.<\/li>\n<li>\u201cgit fetch\u201d: is a command used to get files from the remote repository to the local repository but not into the working directory.<\/li>\n<li>\u201cgit merges\u201d: is a command used to get the files from the local repository into the working directory.<\/li>\n<li>\u201cgit pull\u201d: is a command used to get files from the remote repository directly into the working directory. It is equivalent to a git fetch and a git merge.<\/li>\n<\/ul>\n<p><strong>User Case:<\/strong><\/p>\n<ol>\n<li><strong>When You first start the project:<\/strong><\/li>\n<\/ol>\n<ul>\n<li>Confirm git repo is there on the server or not.<\/li>\n<li>Now you have to install git on your system.<\/li>\n<\/ul>\n<p><strong>Note: The GIt repo you have received is mapped to the master\/Main branch<\/strong><\/p>\n<ol>\n<li><strong>Method to Connect Local Git to Server Github:<\/strong><\/li>\n<\/ol>\n<ul>\n<li>git remote add origin &lt;url&gt;<\/li>\n<li>git push origin master<\/li>\n<li>git push &#8211;set-upstream origin master<\/li>\n<\/ul>\n<ol>\n<li><strong>Steps to Create a new Branch:<\/strong><\/li>\n<\/ol>\n<ul>\n<li>git checkout -b \uff1cnew-branch(Name)\uff1e<\/li>\n<\/ul>\n<ol>\n<li><strong>Next Run this command to get all the repo details from git.<\/strong><\/li>\n<\/ol>\n<ul>\n<li>git fetch<\/li>\n<\/ul>\n<p>git fetch is a command used to get files from the remote repository to the local repository but not into the working directory.<\/p>\n<ol>\n<li><strong>Method to commit your code on GitHub<\/strong><\/li>\n<\/ol>\n<ul>\n<li>git add.<\/li>\n<li>git commit -m \u201c&lt;message&gt;\u201d<\/li>\n<li>git push<\/li>\n<\/ul>\n<ol>\n<li><strong>If you are going to work on an already ongoing project then take a clone<\/strong><\/li>\n<\/ol>\n<ul>\n<li>Git clone \u201creponame or SSH Url\u201d<\/li>\n<\/ul>\n<ol>\n<li><strong>If multiple developers are working on the same project with multiple branches, then how do we get other developers&#8217; code from another branch?<\/strong><\/li>\n<\/ol>\n<ul>\n<li>Git pull origin &lt;branch_name&gt;<\/li>\n<\/ul>\n<p><strong>Sequence For Git Command :<\/strong><\/p>\n<ul>\n<li>Git status (to see which files changed)<\/li>\n<li>Git add. (changes add to server)<\/li>\n<li>Git commit -m (\u201c[Module Name] &#8211; message\u201d)<\/li>\n<li>Git pull origin &lt;branch_name&gt; (to download file code from server)<\/li>\n<li>Git push origin &lt;branch_name&gt; (to push all commits to server)<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u201cgit add .\u201d : is a command used to add a file that is in the working directory to the staging area. \u201cgit commit\u201d: is a command used to add all files that are staged to the local repository. \u201cgit push\u201d: is a command used to add all committed files in the local repository to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7405,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[256,360,661,258],"tags":[722,723,803,804],"class_list":["post-7403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java-application","category-javascript","category-testing","category-web-technology","tag-blog","tag-blogging","tag-git","tag-git-session"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Git Session - InnovationM - Blog<\/title>\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.innovationm.com\/blog\/git-session\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Git Session - InnovationM - Blog\" \/>\n<meta property=\"og:description\" content=\"\u201cgit add .\u201d : is a command used to add a file that is in the working directory to the staging area. \u201cgit commit\u201d: is a command used to add all files that are staged to the local repository. \u201cgit push\u201d: is a command used to add all committed files in the local repository to [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/git-session\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-08T07:37:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/Git-Tutorial.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1689\" \/>\n\t<meta property=\"og:image:height\" content=\"950\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"InnovationM Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InnovationM Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"Git Session\",\"datePublished\":\"2022-09-08T07:37:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/\"},\"wordCount\":379,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Git-Tutorial.png\",\"keywords\":[\"blog\",\"blogging\",\"Git\",\"git session\"],\"articleSection\":[\"Java Application\",\"JavaScript\",\"Testing\",\"Web Technology\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/\",\"name\":\"Git Session - InnovationM - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Git-Tutorial.png\",\"datePublished\":\"2022-09-08T07:37:47+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Git-Tutorial.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/09\\\/Git-Tutorial.png\",\"width\":1689,\"height\":950},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/git-session\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Git Session\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\",\"name\":\"InnovationM Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"caption\":\"InnovationM Admin\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/innovationmadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Git Session - InnovationM - Blog","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.innovationm.com\/blog\/git-session\/","og_locale":"en_US","og_type":"article","og_title":"Git Session - InnovationM - Blog","og_description":"\u201cgit add .\u201d : is a command used to add a file that is in the working directory to the staging area. \u201cgit commit\u201d: is a command used to add all files that are staged to the local repository. \u201cgit push\u201d: is a command used to add all committed files in the local repository to [&hellip;]","og_url":"https:\/\/www.innovationm.com\/blog\/git-session\/","og_site_name":"InnovationM - Blog","article_published_time":"2022-09-08T07:37:47+00:00","og_image":[{"width":1689,"height":950,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/Git-Tutorial.png","type":"image\/png"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/git-session\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/git-session\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"Git Session","datePublished":"2022-09-08T07:37:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/git-session\/"},"wordCount":379,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/git-session\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/Git-Tutorial.png","keywords":["blog","blogging","Git","git session"],"articleSection":["Java Application","JavaScript","Testing","Web Technology"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/git-session\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/git-session\/","url":"https:\/\/www.innovationm.com\/blog\/git-session\/","name":"Git Session - InnovationM - Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/git-session\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/git-session\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/Git-Tutorial.png","datePublished":"2022-09-08T07:37:47+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/git-session\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/git-session\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/git-session\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/Git-Tutorial.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2022\/09\/Git-Tutorial.png","width":1689,"height":950},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/git-session\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Git Session"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed","name":"InnovationM Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","caption":"InnovationM Admin"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/innovationmadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/7403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=7403"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/7403\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/7405"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=7403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=7403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=7403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}