ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • git branch clear , 모든 브랜치 삭제
    Infra & Tools/GIT 2022. 9. 5. 10:44

     

    local main , master 를 제외한 모든 branch 삭제

     git branch | grep -v "master" | grep -v "main"| xargs git branch -D

     

    xargs :  모든 이름 

     

    grep :  Global Regular Epression Print 

    파일에서 원하는 내용만 따로 출력하거나 저장 한다.

     

    grep -v "aa"   : "aa" 라는 파일을 제외하고 

     

    | |     :   파이프 , 연속된 명령어를 입력할때 사용한다. 

    # grep [option] ... "특정 문자열" [file] ...
    
    [옵션]
    -A num, --after-context=num: 특정 문자열로부터 num 이후의 라인까지 출력
    -B num, --before-context=num: 특정 문자열로부터 num 이전의 라인까지 출력
    -C num, --context=num: 특정 문자열로부터 num 이전,이후의 라인까지 출력 (-A num -B num 과 같다)
    --colour, --color=[when]: 특정 문자열을 특정 색으로 표시 ([when] = never, always, auto)
    -d action, --directories=action: 특정 디렉토리에서 특정 문자열 검색
    -e pattern, --regexp=pattern: 여러 특정 문자열로 검색, 한 번에 2개 이상의 특정 문자열로 검색할 때 사용
    -i, --ignore-case: 특정 문자열을 대소문자 구분 없이 검색
    -v, --invert-match: 특정 문자열을 제외한 나머지 행을 검색
    -w, --word-regexp: 다른 문자열이 포함되지 않은 특정 문자열'만' 검색, 특정 문자열을 하나의 단어로 취급

    'Infra & Tools > GIT' 카테고리의 다른 글

    Git 폴더 바로가기 클릭 안됨 해결  (0) 2022.09.19
    Git remote branch 가져오기  (0) 2022.09.05
    Git stash 기초 설명  (0) 2022.09.05
    Git Hub 동시에 두개의 Repo 에 올리기!  (0) 2022.08.06
    GIT 파일 돌리기  (0) 2022.07.18
Designed by Tistory.