Git alias which uses aliases

166 views Asked by At

I would like to use the assume command in order to chain it 5 times.

[alias]
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumeall = "!git ls-files ../.idea/misc.xml | xargs git assume"
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"

but when running i get this error:

fatal: '../.idea/misc.xml' is outside repository

The assume, unassume, unassumeall work just fine.

2

There are 2 answers

3
gmaliar On BEST ANSWER

try

[alias] assumeall = "!git ls-files $(git rev-parse --show-toplevel)/.idea/misc.xml | xargs git assume"

0
VonC On

Simply check if '../.idea/misc.xml' reference a file which is a git repo.

For instance, if you go to the .idea/ folder, and look for the root folder of the git repo, does it return a folder?

git rev-parse --show-toplevel

If not, .idea/ is outside a git repo, and git ls-files cannot be applied.