{"id":319,"date":"2018-07-20T15:30:38","date_gmt":"2018-07-20T15:30:38","guid":{"rendered":"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/?p=319"},"modified":"2018-07-20T17:57:40","modified_gmt":"2018-07-20T17:57:40","slug":"how-to-change-directories-using-git-bash","status":"publish","type":"post","link":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/","title":{"rendered":"How To Change Directories Using Git Bash"},"content":{"rendered":"<p>This brief tutorial describes how to change directories using Git Bash for beginners. Since I am fairly new to using the command line, using tools such as npm, Node.js, and Git Bash, I figured I would describe the process that I used to make life easier for me, when starting a new project and initializing a Git repository. While I have used version control tools such as GUI&#8217;s &#8211; GitHub for Windows, Tortoise SVN for several years, learning the command line can be pretty intimidating and confusing, so providing an easy to understand way to get started being comfortable changing directories on your machine is the goal of this article.<\/p>\r\n<p>This guide assumes that you already have Git installed on your machine and covers a basic installation using Windows 7. This guide also assumes that you have installed Git in the default directory as set in the installation process. On Windows 7, the default directory is <b>C:\\Program Files\\Git<\/b>. To install Git for Windows, click on this <a href=\"https:\/\/git-scm.com\/download\/win\" rel=\"noopener\" target=\"_blank\">link<\/a>. <\/p>\r\n<p>Open Git Bash in your Windows Start menu. Once open you will see the following, an empty window with a dollar sign and a flashing cursor:<\/p>\r\n<img loading=\"lazy\" src=\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen1.png\" alt=\"How To Change Directories Using Git Bash\" width=\"586\" height=\"327\" class=\"alignnone size-full wp-image-324\" srcset=\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen1.png 586w, https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen1-300x167.png 300w\" sizes=\"(max-width: 586px) 100vw, 586px\" \/>\r\n<p>From here you can type &#8220;dir&#8221; or &#8220;ls&#8221;. &#8220;ls&#8221; is a command to list files in Unix and Unix-like operating systems. Using &#8220;dir&#8221; will list the files as shown below:<\/p>\r\n<img loading=\"lazy\" src=\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen2.png\" alt=\"How To Change Directories Using Git Bash\" width=\"592\" height=\"536\" class=\"alignnone size-full wp-image-326\" srcset=\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen2.png 592w, https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen2-300x272.png 300w\" sizes=\"(max-width: 592px) 100vw, 592px\" \/>\r\n<p>Using &#8220;ls&#8221; will list the files as shown below:<\/p>\r\n<img loading=\"lazy\" src=\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen3.png\" alt=\"How To Change Directories Using Git Bash\" width=\"592\" height=\"534\" class=\"alignnone size-full wp-image-330\" srcset=\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen3.png 592w, https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen3-300x271.png 300w\" sizes=\"(max-width: 592px) 100vw, 592px\" \/>\r\n<p>By default, as shown above Git will list the files in your <b>C:\\Users\\%user-profile%<\/b>. You will notice that your folders are color coded. The light blue folders with the @ symbol, are folders that the current Windows account does not have access to. Folders with access are colored dark blue, with files having no color.<\/p>\r\n<p>The first time I worked with Git Bash, I thought the command <b>$ cd \/<\/b> would bring me back to the root folder, the C: drive. However, typing this in will bring you to the folder where Git is installed, <b>C:\\Program Files\\Git<\/b>, which is not what we may want.<\/p>\r\n<img loading=\"lazy\" src=\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen4.png\" alt=\"How To Change Directories Using Git Bash\" width=\"481\" height=\"112\" class=\"alignnone size-full wp-image-332\" srcset=\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen4.png 481w, https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen4-300x70.png 300w\" sizes=\"(max-width: 481px) 100vw, 481px\" \/>\r\n<p>My new repository is located in <b>C:\\Users\\%user-profile%\\Documents\\Git\\.git<\/b>. To get here, we need to type in the following <b>$cd \/c\/users\/&#038;user-profile%\/documents\/git<\/b>, as shown below.<\/p>\r\n<img loading=\"lazy\" src=\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen5.png\" alt=\"How To Change Directories Using Git Bash\" width=\"559\" height=\"70\" class=\"alignnone size-full wp-image-333\" srcset=\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen5.png 559w, https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen5-300x38.png 300w\" sizes=\"(max-width: 559px) 100vw, 559px\" \/>\r\n<p>You will know you are now in a Git repository, evidenced by the <b>(master)<\/b> label after the path name in command prompt. Since this is a new repository, there are no files in my directory, so typing &#8220;ls&#8221; will show no results.<\/p>","protected":false},"excerpt":{"rendered":"This brief tutorial describes how to change directories using Git Bash for beginners. Since I am fairly new to using the command line, using tools such as npm, Node.js, and Git Bash, I figured I would describe the process that I used to make life easier for me, when starting a new project and initializing [&hellip;]","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How To Change Directories Using Git Bash - Web Development Reference<\/title>\n<meta name=\"description\" content=\"How To Change Directories Using Git Bash - Web Development Reference\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Change Directories Using Git Bash - Web Development Reference\" \/>\n<meta property=\"og:description\" content=\"How To Change Directories Using Git Bash - Web Development Reference\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Development Reference\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-20T15:30:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-07-20T17:57:40+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"2 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/#website\",\"url\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/\",\"name\":\"Web Development Reference\",\"description\":\"Web Development Solutions Explained -- Easy\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen1.png\",\"contentUrl\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-content\/uploads\/2018\/07\/git-bash-screen1.png\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/#webpage\",\"url\":\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/\",\"name\":\"How To Change Directories Using Git Bash - Web Development Reference\",\"isPartOf\":{\"@id\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/#primaryimage\"},\"datePublished\":\"2018-07-20T15:30:38+00:00\",\"dateModified\":\"2018-07-20T17:57:40+00:00\",\"author\":{\"@id\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/#\/schema\/person\/9624bee17e4fbdcaad7eb7569f5faa70\"},\"description\":\"How To Change Directories Using Git Bash - Web Development Reference\",\"breadcrumb\":{\"@id\":\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/\",\"url\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/\",\"url\":\"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/how-to-change-directories-using-git-bash\/\",\"name\":\"How To Change Directories Using Git Bash\"}}]},{\"@type\":\"Person\",\"@id\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/#\/schema\/person\/9624bee17e4fbdcaad7eb7569f5faa70\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c0c4e0ed219e3aaa419ce72b52646d59?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c0c4e0ed219e3aaa419ce72b52646d59?s=96&d=mm&r=g\",\"caption\":\"admin\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7o7aF-59","_links":{"self":[{"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/posts\/319"}],"collection":[{"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/comments?post=319"}],"version-history":[{"count":9,"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/posts\/319\/revisions"}],"predecessor-version":[{"id":334,"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/posts\/319\/revisions\/334"}],"wp:attachment":[{"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/media?parent=319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/categories?post=319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.pixelprofessionals.com\/webdevelopmentreference\/wp-json\/wp\/v2\/tags?post=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}