alpine-docker / git

A useful simple git container running in alpine linux, especially for tiny linux distro, such as RancherOS, which don't have package manager.
Apache License 2.0
155 stars 86 forks source link

Update git() function #44

Closed gillesdalle closed 1 year ago

gillesdalle commented 2 years ago

Hello,

This is note an issue, but but a proposal to improve the git() function defined in the optional usage 1. This function requires to be at the same level of .git directory.

With this update, you could run it in every sub folder :

function git () {
    path=$(pwd)
    while [[ "$path" != "" && ! -e "$path/.git" ]]; do
        path=${path%/*}
    done
    if [ -d "$path" ]; then
        docker run -ti --rm -v ${HOME}:/root -v ${path}:/git alpine/git "$@"
    else
        echo "Error: no .git directory found in parents"
    fi
}
ozbillwang commented 1 year ago

We focus the image itself, no support for the git usage.