Alex's Coding Blog
  • Home
  • About
  • Projects
  • Contact me

Blog

Copy Git repository with branches to another server

  • March 14, 2021 March 14, 2021
  • by Alexander

I'm migrating a legacy projects from one git server to another. I would like to keep all branches with me and not only the main.

In general, the steps can be summirized as follows:

  • Clone remote repo locally
  • checkout all remote branches
  • Change origin url to new server
  • Push everything to new origin

Clone repository to local git repo

git clone

Run script to checkout allthe branches

#!/bin/bash

for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done

Fetch all

git fetch --all
git pull --all
git fetch --tags

Check if required branches pulled locally

git branch

Replace origin url

git remote rm origin
git remote add origin https://new.server/project/app.git

Push all branches to new origin

git push origin --all
git push --tags
How-to

Debugging microservices is always tricky and time consuming specially without proper code level logging in place.

Meet Konso. It's developed as a solution for this challenge and can help with saving development effort for your team up to 30%. 🎯🎉

The key functions are:

🔥 Centralized logging for your microservices
🔥 Tracing with metrics and value tracking events
🔥 Ad-Hoc events exploration
🔥 Saving your queries
🔥 Create alerts and get notified


You can start collecting you project's logs in 5 minutes. 🕐💪

To Learn more about logging tool, book a free demo.
To get started for free, Create your free account now

Alexander Lvovich

Solution Architect and Software Developer.

Share on:

No comments are allowed for this post

Recent Posts

  • Easily track and troubleshoot errors in your .NET 7 web app using Konso's logging feature
  • How to disable object model validation .NET 7
  • Keep Your Passwords Safe: 5 Tips for Protecting Yourself After the Latest LastPass Data Breach
  • How to ping from .net application container
  • Freelancing myths you should consider before dive in
  • How to set up a honey token for dotnet project with Konso

Categories

  • Azure
  • Architecture
  • .NET Core
  • Certification
  • DevOps
  • How-to
  • Azure Functions
  • Serverless
  • Cosmos DB
  • Security
  • Thoughts
© Copyright 2023, Alexander Lvovich. Theme by Colorlib