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

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

  • Subject: [OCLUG-Tech] Re: git aliases, was: acceptable bourne shell function names
  • From: Bart Trojanowski <bart [ at ] jukie [ dot ] net>
  • Date: Fri, 3 Jul 2009 23:50:23 -0400
* 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.

-Bart

-- 
				WebSig: http://www.jukie.net/~bart/sig/