Skip to content

Instantly share code, notes, and snippets.

@gullz
Created July 5, 2019 07:31
Show Gist options
  • Save gullz/31d93eeafa78a08e80bff4c3f4df95da to your computer and use it in GitHub Desktop.
Save gullz/31d93eeafa78a08e80bff4c3f4df95da to your computer and use it in GitHub Desktop.
Add directories in to git repo one directory at a time.
#! /bin/bash
navigateDir()
{
files=`ls`
for dir in $files
do
checkDir $dir
done
}
checkDir()
{
dir=$1
if [ $dir == "." ]
then
return
fi
if [ $dir == ".." ]
then
return
fi
cd $dir > /dev/null 2>&1
result=$?
curDir=`pwd`
if [ $result -eq 0 ]
then
cd ..
mv $dir ../aosp
result=$?
else
return
fi
if [ $result -eq 0 ]
then
cd ../aosp
git add .
git commit -m "adding $dir"
git push
else
echo commit failed.
exit 127
fi
cd -
}
navigateDir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment