This post is a crash course on Azure DevOps and the GIT concepts and commands that are used to interact with it.
Azure DevOps Server is a cloud hosted, Software as a service (SaaS) solution and was formerly named Visual Studio Team Foundation Server (TFS). Primarily it allows for the management of code, in addition it also has the following features:
- Boards to support planning, tracking, visualisation, reporting, etc.
- Cloud agnostic CI/CD platform.
- GIT Repositories.
- Package management with support for Maven, Python etc.
- Test Plans.
Firstly we need to understand the concept of repositories. Git has two sorts of repositories: one referred to as local that typically resides on your machine, another called remote that is typically on network share or accessed by HTTP.
This allows you to work on your own local copy of the code repository in isolation from others and, only when ready, collaborate by pushing your code from the local repository to the remote repository.
Team Explorer\GIT Commands
As mentioned DevOps uses a Git Repository, therefore the commands issued are based on Git commands. The following are some of the most common:
Record changes made to the local repository
Download objects and refs from the remote DevOps repository
Applies changes taken from
fetch to a branch on your local repo.
Pull from, and integrate with, the remote DevOps repository, or a local branch. This is effectively a fetch and a merge
Update remote refs along with associated objects in the DevOps repository
Performs a pull and push to effectively sync your local repository with the DevOps repository.
Create a tag object which specifically identifies a version of the code in a branch
The commands above are a short list of those commands available when working with Git repositories, however, they cover the majority of tasks that a developer will need to complete in a ‘normal’ day. They can be represented as follows.
This image is sourced from www.git-tower.com
Q: What is the difference between fetch and pull?
A: Fetch operation never changes any of your own local branches under refs/heads, and is safe to do, pull is brings a local branch up-to-date with the DevOps repository.
Q: What is the difference between a tag and branch?
A: A branch points to the top of a development line and will change when a new commit is pushed a tag will not change. Tags are more useful to identify a specific version of code that does not change.