Skip to content

Instantly share code, notes, and snippets.

@MikeTrizna
Created June 30, 2021 17:58
Show Gist options
  • Save MikeTrizna/3e9efd9989d4a2f927692827bcf2cd05 to your computer and use it in GitHub Desktop.
Save MikeTrizna/3e9efd9989d4a2f927692827bcf2cd05 to your computer and use it in GitHub Desktop.
GitHub Desktop: Creating a “fresh” Git repo vs. turning an existing directory into a Git repo

GitHub Desktop: Creating a "fresh" Git repo vs. turning an existing directory into a Git repo

Creating a "fresh" Git repo

  1. In the top toolbar, click File > "New Repository..."

  2. In the dialog window that pops up, you will be able to provide a lot of information on how to create a new repository in a new directory. If you choose to create a repo with name "git_demo", and choose your Desktop under Local Path, it will create new folder called "git_demo" on the Desktop that is now configured to track changes.

  3. Click the "Create Repository" button to make this all happen.

Turning an existing directory into a Git repo

  1. Let's assume you have an existing folder of data, scripts, documentation, etc. on your Desktop called "git_demo".

  2. In the top toolbar, click File > "Add Local Repository..."

  3. In the dialog box that pops up, click "Choose..." to choose this existing directory described in Step 1. If this directory is not under version control, you will see a warning message "This directory does not appear to be a Git repository. Would you like to create a repository here instead?"

  4. Click the "create a repository" link. It will open a very similar dialog as we saw in the first section. You will be able to change the repository "Name", "Description", and all other options except you will not be able to change the Local Path.

  5. If you click the "Create Repository" button, it will add in some hidden directories under the "git_demo" directory that will enable it to start tracking changes going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment