Git 별칭이 내가 제공한 경로를 찾지 못합니다.

Git 별칭이 내가 제공한 경로를 찾지 못합니다.

나는 이 명령을 자주 입력하기 때문에 git 별칭을 설정하려고 합니다.

git commit -m 'update' -- hdf5_classification/output

내가하고있는 별칭을 만들려면 다음을 수행하십시오.

git config alias.up '! git commit -m 'update' -- hdf5_classification/output'

하지만 별칭을 입력하여 사용하려고 하면 git up다음 오류가 발생합니다.error: pathspec 'hdf5_classification/output' did not match any file(s) known to git.

답변1

hdf5_classification이 저장소의 최상위 디렉터리에 있는 경우 귀하의 명령이 저에게 효과적입니다.

git-config 매뉴얼 페이지에서:

Note that shell commands will be executed from the
top-level directory of a repository, which may not necessarily be
the current directory.

나는 당신이 원하는 명령이 다음과 같다고 생각합니다.

git config alias.up 'commit -m "update" -- hdf5_classification/output'

이는 쉘 명령이 아니기 때문에("!"로 시작하지 않기 때문에) 현재 디렉토리에서 git commit을 실행합니다.

참고 사항: 명령에서 작은따옴표 안에 작은따옴표를 사용하고 있는데, 이는 작동하지만 생각대로 작동하지 않는 것 같습니다. :-)

관련 정보