Created
November 17, 2016 01:08
-
-
Save tilmanschweitzer/92644be0de00e2650614b8b62c608914 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMPONENT_NAME=timepicker | |
GREP_E_MATCHER="(timepicker|other_string)" | |
TMP_BRANCH=$COMPONENT_NAME-tmp | |
git checkout -b $TMP_BRANCH | |
git filter-branch -f --prune-empty --index-filter 'git ls-files | grep -v -E "$GREP_E_MATCHER" | xargs git rm --cached --ignore-unmatch --quiet' HEAD | |
git checkout --orphan $COMPONENT_NAME | |
git rm --cached -r . | |
rm -f .gitignore | |
git clean -fd | |
for GIT_HASH in $(git log --reverse --pretty=format:"%H" --no-merges $TMP_BRANCH); | |
do | |
DIFF=$(git diff $GIT_HASH) | |
if [[ ! -z $DIFF ]]; then | |
echo | |
echo "cherry-pick: $GIT_HASH" | |
git log $GIT_HASH -n 1 --oneline | |
git cherry-pick $GIT_HASH | |
fi | |
done | |
git filter-branch -f --env-filter 'export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment