Skip to content

Instantly share code, notes, and snippets.

View gestj's full-sized avatar
🎯
Focusing

Johannes Gest gestj

🎯
Focusing
View GitHub Profile
@fabiomaggio
fabiomaggio / git-filter-branch-move-files.md
Last active October 20, 2022 08:48
Use git filter-branch to move all projects files to a subdir and rewrite all commits
  1. Clone project

  2. Checkout all branches that contain the files that should be moved

  3. Delete the remote

  4. Run the filter-branch command:

    git filter-branch --tree-filter 'mkdir -p /path/to/tmp; mv * /path/to/tmp; mkdir subdir; mv /path/to/tmp/* subdir/' --tag-name-filter cat --prune-empty -- --all
    • All files are first copied to a temporary dir and move from there to the new destination
  • Existing tags are updated
@gestj
gestj / connect.bitbucket.commit.groovy
Last active December 16, 2015 18:57
Script for jenkins scriptler plugin (works with Jenkins v1.572)
import groovy.json.*
import hudson.model.*
import static groovy.json.JsonOutput.*
import java.util.logging.*
import java.security.MessageDigest
class Bitbucket {
def static BITBUCKET_REST_URL = "https://bitbucket.org"
def static BITBUCKET_API_URL = BITBUCKET_REST_URL + "/api/2.0/"
def static LOGGER = Logger.getLogger("connect.bitbucket.commit.groovy.Bitbucket")