{"id":230,"date":"2020-07-28T07:46:31","date_gmt":"2020-07-28T12:46:31","guid":{"rendered":"https:\/\/www.codedotshow.com\/blog\/?p=230"},"modified":"2020-08-30T15:05:08","modified_gmt":"2020-08-30T20:05:08","slug":"using-git-source-code-control-with-delphi-and-rad-studio-all-the-reasons-why-and-everything-you-need-to-know","status":"publish","type":"post","link":"https:\/\/www.codedotshow.com\/blog\/using-git-source-code-control-with-delphi-and-rad-studio-all-the-reasons-why-and-everything-you-need-to-know\/","title":{"rendered":"Using Git source code control with Delphi and RAD Studio \u2013 all the reasons why and EVERYTHING you need to know"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-1024x576.png\" alt=\"\" class=\"wp-image-261\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-1024x576.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-300x169.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-768x432.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The replay of this webinar is here..<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Using Git Source Code Control in Delphi and RAD Studio, feat. Ian Barker\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/JSswgwPbjNs?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Git?<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>A lot of developers are not using SCCS even though they feel they should<\/li><li>If you Google \u201chow do I use Git\u201d there are a tsunami of questions and answers<\/li><li>Git <strong>dominates<\/strong> the open source and professional development ecosystem \u25aaGit is <em>built <\/em>into Rad Studio<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Other Source Code Control Systems<\/h2>\n\n\n\n<p>Apart from Git there is also <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Subversion \u2013 often referred to as SVN<ul><li>Found at <a href=\"https:\/\/subversion.apache.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/subversion.apache.org\/<\/a> <\/li><li>Very popular, still actively maintained <\/li><\/ul><\/li><li>JEDI VCS<ul><li>Found at <a href=\"http:\/\/jedivcs.sourceforge.net\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/jedivcs.sourceforge.net\/<\/a> <\/li><li>Not updated since April 2017<\/li><\/ul><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u201cI don\u2019t work in a team, why would I use a SCCS\u201d<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>It\u2019s all about the tornadoes<\/li><li>Fire<\/li><li>Theft<\/li><li>Foul-ups<\/li><li>It\u2019s almost impossible to avoid Git \u2013 you will be assimilated!<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What does Git actually do?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"924\" height=\"594\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-2.png\" alt=\"\" class=\"wp-image-263\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-2.png 924w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-2-300x193.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-2-768x494.png 768w\" sizes=\"auto, (max-width: 924px) 100vw, 924px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Tracks all the changes you make<\/li><li>Stores those changes as a viewable history, with comments<\/li><li>Handles changes from multiple developers<\/li><li>When used with a cloud provider \u2013 saves your code safely off-site<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"912\" height=\"590\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-3.png\" alt=\"\" class=\"wp-image-264\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-3.png 912w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-3-300x194.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-3-768x497.png 768w\" sizes=\"auto, (max-width: 912px) 100vw, 912px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Allows you to create <strong>branches<\/strong> for bugs fixes or new features you are working on<\/li><li>Can <strong>merge<\/strong> changes from multiple developers and even your own branches into the main source tree<\/li><li>Allows you to easily revert bad changes or experiments which didn\u2019t work out<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1003\" height=\"427\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-4.png\" alt=\"\" class=\"wp-image-265\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-4.png 1003w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-4-300x128.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-4-768x327.png 768w\" sizes=\"auto, (max-width: 1003px) 100vw, 1003px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>Allows you to <strong>collaborate<\/strong> with major open source projects<\/li><li>Can pinpoint who made a change and therefore who to <strong>blame<\/strong> ?<\/li><li>Allows others to make changes to shared source code in a very managed way<\/li><li>Allows you to share your source code on public web-based services like GitHub, GitLab and BitBucket<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Tools to make Git a lot easier<\/h2>\n\n\n\n<p>Git can sometimes be a little <em>challenging<\/em> to use ?<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>GitHub Desktop<\/strong><ul><li>Found at <a href=\"https:\/\/desktop.github.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/desktop.github.com<\/a><\/li><\/ul><\/li><li><strong>Sourcetree<\/strong><ul><li>Found at <a href=\"https:\/\/www.sourcetreeapp.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.sourcetreeapp.com<\/a><\/li><\/ul><\/li><li><strong>TortoiseGit<\/strong><ul><li>Found at <a href=\"https:\/\/tortoisegit.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/tortoisegit.org<\/a><\/li><\/ul><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Git on your machine<\/h2>\n\n\n\n<p>Use the official \u201cGit for Windows\u201d installer<\/p>\n\n\n\n<p><strong>Git for windows<\/strong> found at <a href=\"https:\/\/gitforwindows.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/gitforwindows.org<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"881\" height=\"572\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-5.png\" alt=\"\" class=\"wp-image-266\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-5.png 881w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-5-300x195.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-5-768x499.png 768w\" sizes=\"auto, (max-width: 881px) 100vw, 881px\" \/><\/figure>\n\n\n\n<p>Accept all the <em>Git for Windows<\/em> defaults\u2026<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"682\" height=\"558\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-6.png\" alt=\"\" class=\"wp-image-267\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-6.png 682w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-6-300x245.png 300w\" sizes=\"auto, (max-width: 682px) 100vw, 682px\" \/><\/figure><\/div>\n\n\n\n<p><strong>Make a note of where it installs because you will need it later.<\/strong><\/p>\n\n\n\n<p>The default for 64bit Windows is:<\/p>\n\n\n\n<p><code>&nbsp;C:\\Program Files\\Git\\bin\\git.exe<\/code><\/p>\n\n\n\n<p>It will install some other cool Open Source things too \u2013 including SubVersion!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"298\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-7-1024x298.png\" alt=\"\" class=\"wp-image-268\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-7-1024x298.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-7-300x87.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-7-768x223.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-7-1536x447.png 1536w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-7-1200x349.png 1200w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-7.png 1636w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>After it Git is installed, check it&#8217;s working correctly:<\/p>\n\n\n\n<p>Go to the terminal \/ command and type<\/p>\n\n\n\n<p>&nbsp;&nbsp; <code>git --version<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"361\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture1-1024x361.png\" alt=\"\" class=\"wp-image-270\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture1-1024x361.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture1-300x106.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture1-768x271.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture1-1536x542.png 1536w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture1-2048x722.png 2048w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture1-1200x423.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Git 101<\/h2>\n\n\n\n<p>Git keeps track of your files in a special collection \/ folder it calls <strong>a repository<\/strong> &#8211; commonly abbreviated to \u201c<strong>repo\u201d<\/strong>.<\/p>\n\n\n\n<p>This works best if you keep all your source files for a particular project in one folder on your computer \u2013 one folder for each project.<\/p>\n\n\n\n<p>Don\u2019t worry if that\u2019s not how you do things \u2013 there are ways around it.<\/p>\n\n\n\n<p>For anything other a purely local set up you will need an account with a Git hosting provider<\/p>\n\n\n\n<p>The main ones are<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>GitHub &nbsp; (I personally use GitHub)<ul><li>Found at <a href=\"https:\/\/github.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com<\/a><\/li><\/ul><\/li><li>GitLab<ul><li>Found at <a href=\"https:\/\/about.gitlab.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/about.gitlab.com<\/a><\/li><\/ul><\/li><li>BitBucket<ul><li>Found at <a href=\"https:\/\/bitbucket.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/bitbucket.org<\/a><\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"546\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture2-1024x546.png\" alt=\"\" class=\"wp-image-272\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture2-1024x546.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture2-300x160.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture2-768x409.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture2-1200x640.png 1200w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/Picture2.png 1488w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The local <strong><em>repo<\/em><\/strong> is tracked in the same folder it \u2018lives\u2019 in using a hidden sub-folder and some \u2018magic\u2019 files.<\/p>\n\n\n\n<p>Everything else is just your regular Delphi source code, images and project resources.<\/p>\n\n\n\n<p>Once you have created a repo in a project folder<strong> any<\/strong> changes you make in the <strong>repo<\/strong> folder are tracked by Git from then on.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Files that existed when you created the repo<\/li><li>New files created<\/li><li>Files deleted<\/li><li>Files edited\/changed<\/li><\/ul>\n\n\n\n<p>This means <strong>everything<\/strong> including things you might not want to track \u2013 but you can tell Git which files to ignore, for example the <code>_history<\/code> folder contents and files ending in <code>.~pas<\/code> and <code>.~dfm<\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Telling Rad Studio your Git settings<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"461\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-10.png\" alt=\"\" class=\"wp-image-274\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-10.png 800w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-10-300x173.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-10-768x443.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><li>In the Rad Studio IDE select <strong><em>tools<\/em><\/strong> and then <strong><em>options<\/em><\/strong> from the menu.<\/li><li>From that menu select <strong><em>version control<\/em><\/strong> and then <strong><em>Git<\/em><\/strong>.<\/li><\/ol>\n\n\n\n<p>Remember the path I told you to make a note of when you installed Git For Windows?&nbsp; This is where you need it ?<\/p>\n\n\n\n<p>The <strong><em>user name<\/em><\/strong> and <strong><em>email<\/em><\/strong> are the ones you use with your Git hosting company and\/or typed in during the Git for Windows installation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Git \u2013 opening an existing repository<\/h2>\n\n\n\n<p>We are going to <strong>\u2018clone\u2019<\/strong> an existing repository.  In other words we\u2019re going to copy it to our local machine.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"498\" height=\"381\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-11.png\" alt=\"\" class=\"wp-image-275\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-11.png 498w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-11-300x230.png 300w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/figure>\n\n\n\n<p>So, first, select <strong>File<\/strong>, <strong>Open From Version Control<\/strong> from the Rad Studio main menu.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"626\" height=\"273\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-12.png\" alt=\"\" class=\"wp-image-276\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-12.png 626w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-12-300x131.png 300w\" sizes=\"auto, (max-width: 626px) 100vw, 626px\" \/><\/figure>\n\n\n\n<p>Now choose <strong>Git<\/strong> from the dialog which appears.<\/p>\n\n\n\n<p>Now enter the <strong>repo\u2019s URL<\/strong> and where you want it to be saved on your <strong>local<\/strong> machine<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"987\" height=\"310\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-13.png\" alt=\"\" class=\"wp-image-278\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-13.png 987w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-13-300x94.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-13-768x241.png 768w\" sizes=\"auto, (max-width: 987px) 100vw, 987px\" \/><\/figure>\n\n\n\n<p>You can find the <strong>repo URL<\/strong> on GitHub by clicking on the \u201ccode\u201d button<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"591\" height=\"469\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-14.png\" alt=\"\" class=\"wp-image-279\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-14.png 591w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-14-300x238.png 300w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/figure>\n\n\n\n<p>Other hosts are very similar \u2013 the keyword to look for is \u201c<strong>clone<\/strong>\u201d.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Success!<\/h2>\n\n\n\n<p>You\u2019ve just <strong>cloned<\/strong> your first repository.&nbsp;<\/p>\n\n\n\n<p>If you look in the folder you entered in the \u2018destination\u2019 field when you opened the project from version control you should see all the Delphi code for the project there along with the magic \u2018.git\u2019 files and folders we talked about. If all you wanted to do was get a copy of an open source repo then there\u2019s nothing else to do but use the code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Git \u2013 creating a new repository<\/h2>\n\n\n\n<p>I find this is easier if you use one of the external tools rather than the Rad Studio IDE ?<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>You can either create a new <strong>repo<\/strong> from existing code<\/li><\/ul>\n\n\n\n<p>&nbsp; <em>or<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Create a blank (empty) <strong>repo<\/strong> and then create a Delphi project in there<\/li><\/ul>\n\n\n\n<p>Either way you need to have an <strong><em>existing<\/em><\/strong> folder on your local machine to hold the repo.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"661\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-15-1024x661.png\" alt=\"\" class=\"wp-image-280\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-15-1024x661.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-15-300x194.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-15-768x495.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-15.png 1082w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I\u2019m using GitHub Desktop.<\/p>\n\n\n\n<p>I have put the name of the <strong>repo<\/strong> as the same name as the folder where I will store my source code.<\/p>\n\n\n\n<p>I have chosen to create a \u201c<strong><code>.GitIgnore<\/code><\/strong>\u201d magic file with Delphi settings so it ignores <code>_history <\/code>and <code>.~*<\/code> backups.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"469\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-16-1024x469.png\" alt=\"\" class=\"wp-image-281\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-16-1024x469.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-16-300x137.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-16-768x352.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-16-1200x550.png 1200w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-16.png 1260w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now my new empty <strong>repo<\/strong> is ready to use.&nbsp;<\/p>\n\n\n\n<p>All it contains are the \u2018magic\u2019 Git files and in this case an empty default readme file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"457\" height=\"106\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-18.png\" alt=\"\" class=\"wp-image-283\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-18.png 457w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-18-300x70.png 300w\" sizes=\"auto, (max-width: 457px) 100vw, 457px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"611\" height=\"435\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-17.png\" alt=\"\" class=\"wp-image-282\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-17.png 611w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-17-300x214.png 300w\" sizes=\"auto, (max-width: 611px) 100vw, 611px\" \/><\/figure>\n\n\n\n<p>Currently the repo is <strong>local<\/strong> only \u2013 just on your computer.&nbsp; Click on the <strong>publish repository<\/strong> button in GitHub desktop to make a copy of it on the cloud hosting company\u2019s storage space.<\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">IMPORTANT!<\/span><\/strong> Tick the \u201ckeep this code private\u201d checkbox if it\u2019s a secret\/private <strong>repo<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Git \u2013 changes get automatically tracked<\/h2>\n\n\n\n<p>Using Git \u2013 changes get automatically tracked<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"262\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-19-1024x262.png\" alt=\"\" class=\"wp-image-285\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-19-1024x262.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-19-300x77.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-19-768x196.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-19-1536x393.png 1536w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-19-1200x307.png 1200w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-19.png 1842w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>At first the new <strong>repo<\/strong> has only one automatically recorded change.<\/p>\n\n\n\n<p>It may show other files if you used an existing folder which already contained a Delphi project or some resources such as graphics.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"710\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-20-1024x710.png\" alt=\"\" class=\"wp-image-286\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-20-1024x710.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-20-300x208.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-20-768x532.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-20.png 1055w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>As you start to work on your project and create new files they will be \u2018noticed\u2019 by Git and automatically tracked.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Git \u2013 saving the changes to the repo<\/h2>\n\n\n\n<p>Mark a batch of changes so they are saved into a history point is called a <strong>commit<\/strong>.<\/p>\n\n\n\n<p>There are three ways to \u201cmake a <strong>commit<\/strong>\u201d:<\/p>\n\n\n\n<p>1. You can do it within <strong>Rad Studio Delphi<\/strong> itself by right-clicking on the changed file or the project in Project Manager and selecting \u201ccommit\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"498\" height=\"779\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-21.png\" alt=\"\" class=\"wp-image-287\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-21.png 498w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-21-192x300.png 192w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/figure>\n\n\n\n<p>2. You can do it via the Windows Terminal (a.k.a the \u2018command line\u2019) using the Git command line<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"335\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-22-1024x335.png\" alt=\"\" class=\"wp-image-288\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-22-1024x335.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-22-300x98.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-22-768x252.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-22.png 1108w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>3. Or use GitHub Desktop \/ SourceTree to commit the changes:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"362\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-23-1024x362.png\" alt=\"\" class=\"wp-image-289\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-23-1024x362.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-23-300x106.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-23-768x271.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-23-1200x424.png 1200w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-23.png 1389w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Whichever way you choose you need to add a \u201c<strong>commit message<\/strong>\u201d.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"449\" height=\"387\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-24.png\" alt=\"\" class=\"wp-image-290\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-24.png 449w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-24-300x259.png 300w\" sizes=\"auto, (max-width: 449px) 100vw, 449px\" \/><\/figure>\n\n\n\n<p>A commit message is a note to say what you changed and why.<\/p>\n\n\n\n<p>These messages are <strong><em>visible<\/em><\/strong> to other developers who have access to your repo.&nbsp;<\/p>\n\n\n\n<p>For Open Source projects this could mean literally anyone so it\u2019s best to keep the comments at a professional level ?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using Git \u2013 YOU\u2019RE NOT DONE YET<\/h2>\n\n\n\n<p>Even though you have <strong>committed<\/strong> (saved) your changes to the <strong>repo<\/strong>\u2019s history log they still are only on your <strong>local<\/strong> machine.<\/p>\n\n\n\n<p>In order for them to go up to the Git repo hosting space you need to <strong>push<\/strong> the changes to the <strong>remote<\/strong> copy of the repo.<\/p>\n\n\n\n<p><strong>Depending on what way you prefer you can either<\/strong><\/p>\n\n\n\n<p>On the <em>command line\/terminal <\/em>you use <code>Git push origin master<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"336\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-25-1024x336.png\" alt=\"\" class=\"wp-image-291\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-25-1024x336.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-25-300x98.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-25-768x252.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-25-1200x393.png 1200w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-25.png 1303w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>OR\u2026<\/p>\n\n\n\n<p>With Rad Studio, right click on the project root and select \u201cGit\u201d and then \u201cpush\u201d, \u201cfrom Repository Root\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"325\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-26-1024x325.png\" alt=\"\" class=\"wp-image-292\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-26-1024x325.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-26-300x95.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-26-768x243.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-26.png 1183w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>OR\u2026<\/p>\n\n\n\n<p>Easiest of all, with GitHub Desktop click on the \u201c<strong>Push origin<\/strong>\u201d button<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"178\" src=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-27-1024x178.png\" alt=\"\" class=\"wp-image-293\" srcset=\"https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-27-1024x178.png 1024w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-27-300x52.png 300w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-27-768x134.png 768w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-27-1200x209.png 1200w, https:\/\/www.codedotshow.com\/blog\/wp-content\/uploads\/2020\/08\/image-27.png 1339w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Using Git \u2013 You nearly know the basics!<\/h2>\n\n\n\n<p>So now we know how to<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Download and install Git<\/li><li>Some popular tools for Git<\/li><li>What is Git and how it works<\/li><li>How to <strong>clone<\/strong> (get a copy) of an existing <strong>repo<\/strong><\/li><li>How to create a new <strong>repo<\/strong><\/li><li>How to <strong>commit<\/strong> (save) our changes<\/li><li>How to <strong>push<\/strong> (send) those changes to the <strong>remote<\/strong> (\u201corigin\u201d) internet host<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Using Git \u2013 but there\u2019s more\u2026<\/h2>\n\n\n\n<p>Git has a lot of other things we\u2019ve not shown yet.&nbsp; These include:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Fetch<\/strong> \u2013 getting any new changes from a shared <strong>repo<\/strong>.<\/li><li><strong>Pull<\/strong> \u2013 this is confusingly-named; it\u2019s where someone makes some changes on a <strong>public<\/strong> or <strong>shared<\/strong> repo and would like you to <strong>merge<\/strong> them into the <strong>main branch<\/strong> of the code.<\/li><li>Resolving <strong>merge <\/strong>conflicts \u2013 this is where two sets of changes to the same file can\u2019t be merged automatically and someone has to intervene to decide which ones to keep.<\/li><\/ul>\n\n\n\n<p><strong>Branches<\/strong> and <strong>pull requests<\/strong> are the two biggest things you will need to understand.<\/p>\n\n\n\n<p>Because we have limited time for this webinar we can\u2019t show you everything so we\u2019re going to do a part two covering the next stage: <strong>Collaborating with other developers using Git<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Good resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Git The Simple Guide <\/strong><a href=\"https:\/\/rogerdudler.github.io\/git-guide\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/rogerdudler.github.io\/git-guide<\/a><\/li><li><strong>Git\u2019 Delphi <\/strong><a href=\"https:\/\/fixedbycode.blogspot.com\/2015\/02\/git-delphi.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/fixedbycode.blogspot.com\/2015\/02\/git-delphi.html<\/a><\/li><li><strong>The beginner\u2019s guide to contributing to a GitHub project <\/strong><a href=\"https:\/\/akrabat.com\/the-beginners-guide-to-contributing-to-a-github-project\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/akrabat.com\/the-beginners-guide-to-contributing-to-a-github-project\/<\/a><\/li><li><strong>GitHub Desktop Documentation <\/strong><a href=\"https:\/\/docs.github.com\/en\/desktop\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/docs.github.com\/en\/desktop<\/a><\/li><li><strong>My blog post about this webinar <\/strong><a href=\"https:\/\/tinyurl.com\/delphigit\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/tinyurl.com\/delphigit<\/a><\/li><li><strong>You can reach me here<\/strong> <a href=\"https:\/\/about.me\/IanBarker\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/about.me\/IanBarker<\/a><\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The replay of this webinar is here.. Why Git? A lot of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-230","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/posts\/230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/comments?post=230"}],"version-history":[{"count":6,"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/posts\/230\/revisions"}],"predecessor-version":[{"id":299,"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/posts\/230\/revisions\/299"}],"wp:attachment":[{"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/media?parent=230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/categories?post=230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codedotshow.com\/blog\/wp-json\/wp\/v2\/tags?post=230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}