2017-05-15 10 views

답변

5

원하는 커밋을 다시 쓸 수있는 git filter-branch의 작업처럼 보입니다. 이러한 커밋이 아직 푸시되지 않았기 때문에 콘텐츠 (및 결과적으로 SHA1)를 변경하는 것은 큰 문제가되지 않습니다.
리베이스 또는 체리 피킹이하는 효과는 재생되는 각 커밋에 대해 명령을 실행할 수 있다는 점을 제외하고는 효과가 비슷합니다. 당신은 run a filter-branch over the last few commits을 할 수

은 다음 git-clang-format syntax을 고려 Elliot Chance

git filter-branch --tree-filter 'git-clang-format' -- <SHA1>..HEAD 

에 의해

페이지의 "Reformatting Your Codebase with git filter-branch"는, 당신은 각 커밋에서 변경된 파일에 적용 할 수 있습니다.
예를 들어 , .cpp에 대한 파일 :

git filter-branch --tree-filter 'git-clang-format $(\ 
    git diff-index --diff-filter=AM --name-only $GIT_COMMIT |\ 
    grep .cpp)' -- <SHA1>..HEAD 

업데이트 2017, 힘내와 2.14.x (Q4 2017)/2.15 당신은 그림이 있습니다

2017 commit 2118805, commit 6134de6 (8월 14일 참조)에 의해 Brandon Williams (mbrandonw).

메이크 (2017 9월 25일, commit a36f631Junio C Hamano -- gitster --에 의해 합병) : 추가 스타일 빌드 규칙

HEAD와의 DIFF 에 git-clang-format를 실행할 'style가'구축 규칙을 추가 현재 작업 트리.
결과가 변경되었습니다.

.PHONY: style 
style: 
    git clang-format --style file --diff --extensions c,h