Skip to content

Instantly share code, notes, and snippets.

View marceln's full-sized avatar

Marcel Nita marceln

  • Craiova, Romania
View GitHub Profile
@jseed
jseed / gist:5d022570ea52ee09a8f43913214496f1
Last active March 12, 2025 08:52
PowerShell command to delete all branches except master
git checkout master; git branch -D @(git branch | select-string -NotMatch "master" | Foreach {$_.Line.Trim()})
@niksumeiko
niksumeiko / git.migrate
Last active April 29, 2025 08:03
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.