home | list info | list archive | date index | thread index

[OCLUG-Tech] Re: git aliases, was: acceptable bourne shell function names

On 30/06/09 Bart Trojanowski said:

> See if this works for you...
> 
> git config --global alias.dirstatus '!ls -d1 */.git | xargs -n1 -i{} sh -c
> "cd {}/.. && echo Checking {} && git ls-files --exclude-standard -tousmd"'  
> 
> I took the liberty to using git ls-files instead of git status.  Feel
> free to change it back to use git-status if you like it more :)

How would you make a git alias out of this?

# Simulate hg's addremove command.
git_addremove()
{
    git add -A || return
    removed_files=$(git ls-files --deleted -z)
    if [ -n "$removed_files" ]; then
        echo "$removed_files" | xargs -0 git rm
    fi
}

Mike
-- 
Michael P. Soulier <msoulier [ at ] digitaltorque [ dot ] ca>
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein

Attachment: pgpjwfjTMq5bi.pgp
Description: PGP signature