Skip to main content
Fetching all branches and tags from a remote Git repository
  1. Posts/

Fetching all branches and tags from a remote Git repository

·164 words·1 min
Christoph Petersen
Author
Christoph Petersen

In my first days at HorseAnalytics, one of the first tasks was to review the codebase and streamline the build and release process. That meant to move all repositories over to Azure DevOps so that we can use the pipelines to build and release new versions of our products.

With Git moving repositories is rather easy but if you want to move everything over including branches and tags there are some things you need to consider. Luckily Stack Overflow had all the answers you could wish for.

My process looks like the following:

  1. Clone the source repository
  2. Setup  branches to track their remote counterpart: git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
  3. Fetch everything: git fetch --all
  4. Add new remote: git remote add azure <Azure DevOps Git URI>
  5. Push everything: git push --all azure
  6. Push tags: git push --tags azure

One done I now have everything including branches and tags in the new repository:

Screenshot of the imported branches

Related

Introducing: Azure DevOps

·146 words·1 min
Yesterday Microsoft announced the evolution of DevOps. Or rather the evolution of DevOps tooling from Microsoft known as Visual Studio Team Services: Azure DevOps.

Remove data from BACPAC file

·158 words·1 min
Today I needed to create a test database for one of the products I’m working on. In the backend it uses LINQ to SQL against a SQL Azure Database. Exporting the production database and cleaning it up with millions of records in it turned out to be not the most efficient way of creating an empty test database.

Moving on: Leaving Microsoft

·138 words·1 min
After spending close to eight years in different roles at Microsoft, my time with Microsoft has come to an end. I accepted a new role, starting on May 1st, as Chief Technology Officer with HorseAnalytics an animal tech startup focused on providing a telemetry data platform for horses.