Skip to content

Instantly share code, notes, and snippets.

View javierexposito's full-sized avatar

Javier Expósito javierexposito

View GitHub Profile
@javierexposito
javierexposito / git-mv-with-history
Created March 1, 2018 14:35 — forked from emiller/git-mv-with-history
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@javierexposito
javierexposito / move-with-history
Last active March 1, 2018 09:58
Move files into a new directory preserving history
-- create a new empy repo, add the origin of the repo we want to move files, create new branch and fetch
mkdir new-repo
cd new-repo
git init
git remote add origin git@github.com:javierexposito/origin-repo.git
git commit --allow-empty "Initial commit"
git checkout moving-files
git fetch origin
git subtree add --prefix=new-folder f54a8b6d7 (last commit from repo)
git push origin
@javierexposito
javierexposito / gist:7b24681a12d6400afe89
Created July 7, 2014 09:56
Compare between version on git
git log 2.0.0-alpha23...2.0.0-alpha24 --pretty=format:"(%h) %s" --reverse | grep -v Merge
@javierexposito
javierexposito / gist:5908362
Last active December 19, 2015 05:59
What has been merged in current branch since the last release tag (X.X.X)
git log `git describe --abbrev=0`..HEAD --merges --oneline