{"componentChunkName":"component---src-templates-blog-post-template-js","path":"/2017/05/31/gets-better-with-git/","result":{"data":{"mdx":{"id":"b465bae8-287e-5195-9502-3b292471ae8c","frontmatter":{"title":"Just starting out with Git and GitHub? It gets easier, honest!","date":"2017 May 31st","cover":{"id":"d27e225a-3195-5270-ae2a-c57864579c2f","publicURL":"/static/cover-4af9973fe95e5822d8c938cec19bbc6c.jpg"}},"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"date\": \"2017-05-31T00:00:00.000Z\",\n  \"title\": \"Just starting out with Git and GitHub? It gets easier, honest!\",\n  \"tags\": [\"information\", \"guide\"],\n  \"published\": true,\n  \"cover\": \"./cover.jpg\"\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"No doubt you have heard of Git or GitHub for source control, but\\n\", mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"what is source control?\")), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, \"\\u201CRevision control (also known as version control, source control or\\n(source) code management (SCM)) is the management of multiple\\nrevisions of the same unit of information.\\u201D\")), mdx(\"p\", null, \"Cool story br0! In other words: Source control allows distributed work\\nin teams of any size, at different locations, while avoiding conflicts\\nin source code changes.\"), mdx(\"p\", null, \"Really!? Thanks for clearing that up!\"), mdx(\"p\", null, \"Lets look at it this way\\u2026\"), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, \"In its simplest term it\\u2019s like a \\u201CSave As\\u201D. You want the new file\\nwithout getting rid of the changes on the old one. It\\u2019s an everyday\\nsituation, except on a software project there is the potential for a\\nlot of changes.\")), mdx(\"p\", null, mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://twitter.com/lindakatcodes/status/869086021220261888\",\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"https://twitter.com/lindakatcodes/status/869086021220261888\")), mdx(\"p\", null, \"A familiar sentiment for anyone starting out with Git\"), mdx(\"h2\", {\n    \"id\": \"concepts\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#concepts\",\n    \"aria-label\": \"concepts permalink\",\n    \"className\": \"anchor-toc before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  })))), \"Concepts\"), mdx(\"p\", null, \"There are some basic concepts about version control I\\u2019ll quickly go\\nover here, these terms used in many SCM systems some relevant to Git\\nand GitHub some to other systems.\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Repository/repo:\"), \" The database storing the files.\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Branch:\"), \" Create a separate copy of a repo for use on your computer.\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Revert/rollback:\"), \" Go back to a previously saved version of the\\ncodebase/repo.\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Push:\"), \" Push is an access level on the repo, if you have no push\\naccess you will need to make a pull request.\"), mdx(\"p\", null, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Pull:\"), \" If you have no Push access you can make a pull request which\\nwill notify the repo owner you want to merge your changes into their\\ncode.\"), mdx(\"p\", null, \"If you are just starting out then your most used commands will\\nprobably be :\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-bash\"\n  }), \"git add .\\ngit commit -m 'some informative message'\\ngit push origin master\\n\")), mdx(\"p\", null, \"Those commands have served me well in my early days of learning how to\\nget my code back up to GitHub.\"), mdx(\"p\", null, mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"video: https://www.youtube.com/watch?v=CDeG4S-mJts\")), mdx(\"blockquote\", null, mdx(\"p\", {\n    parentName: \"blockquote\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Git and GitHub\"), \" Git and GitHub are two separate things, Git is a\\nfree and open source version control system whilst GitHub uses Git\\ntechnology to host your repositories on the GitHub.com servers.\")), mdx(\"p\", null, \"Git and GitHub were a bit confusing for me when I first started out\\nwith them, I was familiar with VCS before but that was in the shape of\\nMicrosoft\\u2019s Visual SourceSafe and Team Foundation Server where you\\nhave a nice GUI to guide you through the check-in and check-out\\nprocess, for those the process was:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Check-out:\"), \" make a copy of the repository you wanted to make\\nchanges to on your machine, once you have made your change then,\\nCheck-in your changes.\")), mdx(\"li\", {\n    parentName: \"ul\"\n  }, mdx(\"p\", {\n    parentName: \"li\"\n  }, mdx(\"strong\", {\n    parentName: \"p\"\n  }, \"Check-in:\"), \" add your changes back to the repository with an\\naccompanying message detailing the change you have made.\"))), mdx(\"p\", null, \"With Git it\\u2019s a bit less fancy, all via the command line, but pretty\\nmuch the same as with VSS and TFS.\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Clone the repository: Make a copy of the repo on your machine.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Make changes.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Once the changes are made then add them back with accompanying\\ncommit messages.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Push the changes back to the repo on Github.\")), mdx(\"p\", null, \"The documentation on GitHub is fantastic for anything you want to\\nachieve and in this post I have referenced some the documentation.\"), mdx(\"p\", null, \"It can get a bit overwhelming though, especially if you get out of\\nsync, i.e. forget to pull a change made on the remote then try to\\ncheck your changes in before pulling the changes into your local\\nversion. I\\u2019m by no means confident if things go a bit wrong but I have\\ndeveloped a \\u201C\", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://gist.github.com/SethRobertson/1540906/68feeabfe906ec1eb893e4fa45f402795ed6e62c#commit\",\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"Commit Often Perfect Later\"), \"\\u201D approach so if you do break\\nsomething you din\\u2019t lose too much of you valuable time trying to work\\nout what went wrong where.\"), mdx(\"p\", null, \"If you take a look at a repo you have cloned from GitHub you will see\\nthere is a file called \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \".git\"), \" this is like a little database of all\\nthe changes you have made on your machine and it contains all the\\ninformation it needs to connect to GitHub and make the changes it\\nneeds to make to the master repo \", \"[or whatever branch you\\u2019re pushing\\nthe changes to]\", \".\"), mdx(\"p\", null, \"I made a cheat sheet \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://gist.github.com/spences10/5c492e197e95158809a83650ff97fc3a#useful-git-commands\",\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"Gist\"), \" which I used every time I went near Git,\\nit has now turned into a \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://github.com/spences10/cheat-sheets\",\n    \"target\": \"_blank\",\n    \"rel\": \"noopener\"\n  }), \"repo\"), \" of other cheat sheets I still use on a\\ndaily basis.\"), mdx(\"p\", null, \"In it I cover these situations:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Make a new project on your machine that you want to add to GitHub?\\nLook here.\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Cloning a repo from someone else\\u2019s GitHub and pushing it to a repo\\non my GitHub, or \\u201CI didn\\u2019t make a fork, what do I do now!\\u201D\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"You have a fork which you need to update before making any changes.\")), mdx(\"p\", null, \"Workflow will be different for differing situations, for me as a noob\\ndeveloper I have tried to document anything I have come across with\\nGit so I can reference back to it for that one time I need it but\\ncan\\u2019t remember what I did at 21:45 on a Wednesday just to get the code\\nchecked into GitHub.\"), mdx(\"p\", null, \"There are many GUIs that integrate with Git for use with GitHub the\\nofficial GitHub one is pretty nice but I quickly got into situations\\nthat the GUI couldn\\u2019t get me out of so I have stuck with the terminal\\nsince, well there is VSCode though which has a beautiful Git UI that I\\nuse daily, but there are some things that I still use the terminal\\nfor:\"), mdx(\"pre\", null, mdx(\"code\", _extends({\n    parentName: \"pre\"\n  }, {\n    \"className\": \"language-bash\"\n  }), \"git status\\ngit checkout <branch-name>\\ngit [push] tags\\n\")), mdx(\"p\", null, \"All pretty handy, there is probably extensions out there to help with\\nthese but for now I\\u2019m pretty comfortable doing it via the command\\nline.\"), mdx(\"p\", null, \"Any tips or tricks you use in Git you\\u2019d like to share? Please feel\\nfree to leave a comment or better still add to the repo via a pull\\nrequest.\"), mdx(\"p\", null, \"If any of this has helped you in any way feel free to like the article\\nand share it on social media.\"), mdx(\"p\", null, \"Many thanks.\"));\n}\n;\nMDXContent.isMDXComponent = true;","excerpt":"No doubt you have heard of Git or GitHub for source control, but\n what is source control? “Revision control (also known as version control…","tableOfContents":{"items":[{"url":"#concepts","title":"Concepts"}]},"timeToRead":4,"fields":{"slug":"/2017/05/31/gets-better-with-git/","editLink":"https://github.com/spences10/thelocalhost.blog/edit/authoring/posts/2017/05/31/gets-better-with-git/index.md"}}},"pageContext":{"slug":"/2017/05/31/gets-better-with-git/","previous":{"id":"66e6994d-da73-5c1e-8aae-06db8b54f4d8","excerpt":"How to build and deploy a multifunctional Twitter bot! This is a reference for me and anyone else that's interested in\nTwitter bots in JavaScript. All of the examples here use the  npm  package  twit . We'll go through setting up a simple bot so each…","frontmatter":{"title":"Twitter bot playground","date":"2017-05-23T00:00:00.000Z"},"fields":{"slug":"/2017/05/23/twitter-bot-playground/"}},"next":{"id":"b4981904-af5f-57a8-bdc0-11ed861b5837","excerpt":"Speed up your git workflow with git aliases, this is a brief\nintroduction on using aliases 👌🚀👍 The more you work with Git the more familiar you become with the\ncommands used in your every day workflow for your projects or your\nteam's projects…","frontmatter":{"title":"Moving from beginner to (slightly more) advanced git with aliases.","date":"2017-06-01T00:00:00.000Z"},"fields":{"slug":"/2017/06/01/beginner-to-git-aliases/"}}}}}