Quickstart: Code with Git
Azure DevOps Services | TFS 2018 | TFS 2017 | TFS 2015 | TFS 2013
In this quickstart, you learn how to share your code with others. After you create a new organization and project in Azure DevOps, you can begin coding with Git.
To work with a Git repo, you clone it to your computer. Cloning a repo creates a complete local copy of the repo for you to work with, and downloads all commits and branches in the repo and sets up a named relationship with the repo on the server. Use this relationship to interact with the existing repo, pushing and pulling changes to share code with your team.
Install Git command line tools
Install one of the following Git command line tools:
- To install Git for Windows, including Git Credential Manager, see Install the Git Credential Manager - Windows
- To install Git for macOS and Linux, see Install the Git Credential Manager - macOS and Linux
Clone the repo to your computer
The New navigation feature provides a vertical navigation experience and is in preview for Azure DevOps Services. When you enable new navigation, you automatically enable several new Agile tool features that are described in the New Work Hubs blog post.
On-premises Microsoft Team Foundation Server users can select Previous navigation for guidance.
Open the Git command window (Git Bash on Git for Windows), navigate to the folder where you want the code from the repo stored on your computer, and run
git clonefollowed by the path copied from the Clone URL in the previous step, as shown in the following example.
git clone >https://contoso-ltd.visualstudio.com/MyFirstProject/_git/contoso->demo
Keep this command window open, as you'll use it in the following steps.
Work with the code
In the following steps, we'll make a change to the files on your computer, commit the changes locally, push the commit to the repo that is stored on the server, and view the changes there.
Browse to the folder on your computer where you cloned the repo, open the
README.mdfile in your editor of choice, make some changes, and save and close the file.
In the Git command window, navigate to the
contoso-demodirectory by entering the following command:
Commit your changes by entering the following command in the Git command window:
git commit -a -m "My first commit"
When you're using
-ameans to commit all changed files, and
-mspecifies a commit message.
Push your changes up to the Git repo on the server by entering the following command into the Git command window: