{"id":177,"date":"2023-08-01T13:44:07","date_gmt":"2023-08-01T19:44:07","guid":{"rendered":"https:\/\/kop.lat\/blog\/?p=177"},"modified":"2023-08-02T14:35:34","modified_gmt":"2023-08-02T20:35:34","slug":"how-to-create-and-use-a-local-git-repository","status":"publish","type":"post","link":"https:\/\/kop.lat\/blog\/how-to-create-and-use-a-local-git-repository\/","title":{"rendered":"How to create and use a local git repository"},"content":{"rendered":"\n<p>Initialize<\/p>\n\n\n\n<p><code>git init .<\/code><\/p>\n\n\n\n<p>Create your first commit (step required):<\/p>\n\n\n\n<p><code>git commit --allow-empty -m \"Initial commit\"<\/code><\/p>\n\n\n\n<p>the default name is in field:<\/p>\n\n\n\n<p><code>init.defaultbranch=main\" in: git config -l<\/code><\/p>\n\n\n\n<p>Check the config list: <\/p>\n\n\n\n<p><code>git config --list<\/code><\/p>\n\n\n\n<p>Create a new branch:<\/p>\n\n\n\n<p><code>git branch branch1<\/code><\/p>\n\n\n\n<p>List all branches and check where are now:<\/p>\n\n\n\n<p>git branch -l git branch &#8211;list<\/p>\n\n\n\n<p>Change branch, to main, in this case:<\/p>\n\n\n\n<p><code>git checkout main<\/code><\/p>\n\n\n\n<p>Change branch, to branch1, in this case:<\/p>\n\n\n\n<p><code>git checkout branch1<\/code><\/p>\n\n\n\n<p>Create and change branch in 1 command:<\/p>\n\n\n\n<p><code>git checkout -b my-new-branch<\/code><\/p>\n\n\n\n<p>Set the user.name config:<\/p>\n\n\n\n<p><code>git config --global user.name \"<code>jamechothepuppy<\/code>\" (jamechothepuppy is my name)<\/code><\/p>\n\n\n\n<p>Set the user.email config:<\/p>\n\n\n\n<p><code>git config --global user.email \"<code>jamechothepuppy<\/code>@example.com\"<\/code><\/p>\n\n\n\n<p>To add files to stagging area:<\/p>\n\n\n\n<p><code>git add &lt;file&gt;<\/code><\/p>\n\n\n\n<p>To commit (from stagging area to local repo):<\/p>\n\n\n\n<p><code>git commit -m \"feature implemented\"<\/code><\/p>\n\n\n\n<p>No need to push, because is local (at least for now).<\/p>\n\n\n\n<p>The &#8220;.git&#8221; folder in a repository represents the local repository itself, not the staging area.<\/p>\n\n\n\n<p>that&#8217;s all, enjoy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Initialize git init . Create your first commit (step required): git commit &#8211;allow-empty -m &#8220;Initial commit&#8221; the default name is in field: init.defaultbranch=main&#8221; in: git config -l Check the config list: git config &#8211;list Create a new branch: git branch branch1 List all branches and check where are now: git branch -l git branch &#8211;list [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":238,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,9,12,13,14,4,7,8],"tags":[15,16,11],"_links":{"self":[{"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/posts\/177"}],"collection":[{"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":3,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":242,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/posts\/177\/revisions\/242"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/media\/238"}],"wp:attachment":[{"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kop.lat\/blog\/wp-json\/wp\/v2\/tags?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}