Created
December 16, 2014 18:53
-
-
Save bahmutov/3d59a57d91e1d9b772f5 to your computer and use it in GitHub Desktop.
Adds file into old commit (and all commits after that)
This file contains 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
file_path=bower_components/angular-bindonce/bindonce.js | |
before_commit=$(git rev-parse --verify 14f0b9d) | |
file_blob=$(git hash-object -w "$file_path") | |
echo "before commit $before_commit" | |
echo "file blog $file_blob" | |
git filter-branch \ | |
--index-filter ' | |
if x=$(git rev-list -1 "$GIT_COMMIT" --not '"$before_commit"') && | |
test -n "$x"; then | |
git update-index --add --cacheinfo 100644 '"$file_blob $file_path"' | |
fi | |
' \ | |
--tag-name-filter cat \ | |
-- --all | |
git reset --hard |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could double all newer commits, use with caution