By default, Team Explorer sets your default location for your Git repos at \Users\<username>\Source\Repos, as seen in yesterday’s example
If you want to change this location, perhaps to remove the Source directory from the path to save you a few extra clicks, you can go to Team Explorer – Settings
and then click Git – Global Settings
From there you can change the path.
- This change only affects new cloned projects moving forward. Your previously cloned repos will remain in their original directory.
- GitHub Desktop uses a different repo (\Users\<username>\Documents\GitHub) than Visual Studio. This change in Team Explorer doesn’t change the default location in GitHub Desktop. If you want both GitHub Desktop and Team Explorer to use same location, you’ll need to change the default location in GitHub Desktop as well.
It is time to get into coding examples from the command line!
In previous tips, you used either the Create new file or Edit file buttons on GitHub.com itself to make changes to a repo. Then you selected the Create a new branch for this commit option in either the Commit new file or Commit changes form to create a new branch (which will be used by a Pull Request).
In the upcoming days, you’ll see how to setup a branch in your local repo so you can submit a bug fix to the base repo as a Pull Request.
From your favorite Command line Interface (I’m using GitHub Desktop’s Git Shell that opens Git Bash – see yesterday’s tip), you’ll want to
- Clone the repo
- Create a branch (see tomorrow’s tip)
- Make your changes (see tomorrow’s tip)
- Push your branch back up to your GitHub repo (see the day after tomorrow’s tip)
But first, let’s clone the repo.
Go to the desired repo. For this example, I’m using saraford-tips/your-moment-of-github-zen
You can get the clone instructions from clicking the Clone or download dropdown button, and then coping the URL (either select the text inside the edit box or click the Copy to clipboard button).
Now from the command line, run git clone <copied url>
Now cd into your repo, and you are all set locally! I always do a git status just out of habit.