Last active
October 26, 2020 00:20
-
-
Save ifnull/5761255 to your computer and use it in GitHub Desktop.
git add alias for git annex that excludes selected file extensions from master and adds them to annex.
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
####################### | |
# Setup | |
####################### | |
mkdir annex-test | |
cd annex-test | |
git init | |
git annex init master | |
####################### | |
# Fab setup task | |
####################### | |
git config --local core.excludesfile ./.gitignore_large_binaries | |
git config --local alias.a '! sh ./git-add.sh' | |
####################### | |
# git a (git-add.sh) | |
####################### | |
# Generate annex include arg from .gitignore_large_binaries | |
include_str="--include='.lazy'"; | |
while read line | |
do | |
if [[ "$line" != *"#"* ]] && [[ "$line" != "" ]]; then | |
include_str="$include_str --or --include=${line}"; | |
fi | |
done < "./.gitignore_large_binaries" | |
# git annex add | |
git config --local core.excludesfile ./.gitignore; | |
git annex add $1 $include_str; | |
# git add | |
git config --local core.excludesfile ./.gitignore_large_binaries; | |
git add $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is support for something like this in newer versions of git-annex.
See: https://git-annex.branchable.com/tips/largefiles/