On 03/07/09 Bart Trojanowski said:
> * Michael P. Soulier <msoulier [ at ] digitaltorque [ dot ] ca> [090703 19:50]:
> > 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
> > }
>
> I have not tried this, but it should work...
>
> !git add -A && removed_files=$(git ls-files --deleted -z) && echo "$removed_files" | xargs -0 git rm
>
> My shell is zsh, and the pattern of X=$(foo) && bar does work there.
msoulier@anton:~/temp/rst$ git init
Initialized empty Git repository in /home/msoulier/temp/rst/.git/
msoulier@anton:~/temp/rst$ git addremove
fatal: pathspec '
' did not match any files
That complaint is why I have an if check in my function.
Can I embed one here? I haven't figured out how to get a semicolon into a git
alias.
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:
pgpaaC0Hdy9BJ.pgp
Description: PGP signature