On Monday, October 22, 2012 1:20:28 PM UTC+2, Artem Grebenkin wrote:

> Hi folks,
> there is some nice feature in bash if I would like to run next command 
> with last executed commands arguments *$(history -p !!:2*)*:
> So for example:
> I have alias in .bashrc *alias ll="ls -la $(history -p !!:2*)"*
> >* ls dev prod*
> > *ll*
> *ls -la dev prod*
> So this expanding dont seems to work in .gitconfig. If I use *da =!"git 
> add $(history -p !!:2*)"*, git says unable to expand !!:2*.
> My use case is, after I ran *git diff test.py test1.py* and checked all 
> changes stage only this files, so I should then run *git add test.py 
> test1.py*. Instead I'd like to run* git ad*.
> Thanks for help!

Create a bash script called git-da. Make it executable and in your $PATH. 

git add $(history -p !!:2*)

You should be able to execute it using "git da". 

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To view this discussion on the web visit 
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to