데보션앱 소개페이지 바로가기
로그인 선택

신고하기

CLOSE
신고사유 (대표 사유 1개)
상세내용 (선택)
0/200
  • 신고한 게시글은 더 이상 보이지 않습니다.
  • 이용약관과 운영정책에 따라 신고사유에 해당하는지 검토 후 조치됩니다.
  • 허위 신고인 경우, 신고자의 서비스 이용이 제한될 수 있으니 유의하시어 신중하게 신고해 주세요.
(이 회원이 작성한 모든 댓글과 커뮤니티 게시물이 보이지 않고, 알림도 오지 않습니다.)

미리보기

커뮤니티

      1,234

      badge 23.06.15

      글 등록

      카테고리를 선택해주세요.

      DEVOTEE를 활성화 시키면
      지금 작성한 커뮤니티 글에 대해 1개의 댓글을 달아줍니다.

      버튼을 누르면 글 수정 시 ChatGPT가 작성한 댓글이 수정됩니다.

      임시저장함에 저장되었습니다. 저장일시 : 2022.5.17 14:29:08

      임시저장함

      제목을 선택하시면 이어서 작성이 가능하며,
      최대 20건까지 저장합니다.
      컨텐츠 유형, 제목, 저장일시, 삭제로 이뤄진 임시저장 목록
      컨텐츠 유형 제목 저장일 삭제

      데보션 블로그 게재 요청

      CLOSE
      • *
      • *

      본인인증

      효율적인 데보션 서비스 이용 및
      고객님의 소중한 개인정보보호를 위해
      본인인증을 진행해주세요. 본인인증 미 진행 시 로그인이 제한됩니다.
      본인인증 실패

      본인인증 로그인에 실패하였습니다.
      회원이 아니시거나 본인인증 등록이
      완료되지 않은 사용자입니다.

      회원정보 연결

      GitHub CLI, life is short.

      onevirus 21.09.16
      2,702 4 0

      GitHub CLI

      GitHub CLI(이하 gh) 는 GitHub 에서 제공하는 terminal 도구입니다. gh 를 이용하면 일반적인 작업 흐름인 이슈생성 -> 브랜치 생성 -> commit & push -> pull request -> merge 전체를 terminal 에서 할 수 있습니다. 느린 GitHub 의 web page loading 을 기다리지 않아도 되고, 클릭을 위해 마우스로 손을 옮기지 않아도 되기 때문에 많은 시간을 절약할 수 있습니다.

       

      Install

      공식 홈페이지(https://cli.github.com)에서 다운로드 받거나 brew 로 간단히 설치 가능합니다.

      brew install gh
      

       

      Login

      auth 명령어를 통해 로그인 설정을 할 수 있습니다.

      gh auth login
      
      ? What account do you want to log into? GitHub.com
      ? What is your preferred protocol for Git operations? SSH
      ? Upload your SSH public key to your GitHub account? /Users/******/.ssh/id_rsa.pub
      ? How would you like to authenticate GitHub CLI? Paste an authentication token
      Tip: you can generate a Personal Access Token here https://github.com/settings/tokens
      The minimum required scopes are 'repo', 'read:org', 'admin:public_key'.
      ? Paste your authentication token: ****************************************
      - gh config set -h github.com git_protocol ssh
      ✓ Configured git protocol
      ✓ Uploaded the SSH key to your GitHub account: /Users/******/.ssh/id_rsa.pub
      ✓ Logged in as onevirus
      

       

      Clone repository

      https 나 ssh 가 아닌 gh 로 repo clone 을 할 수 있습니다. 아래에서 보이는 것 처럼 github.com 이 생략된 owner 와 repo_id 만으로 clone 이 가능하기 때문에 git 명령을 사용하는 것보다 명령어가 간결합니다.

      git clone https://github.com/apache/airflow.git
      git clone git@github.com:apache/airflow.git
      gh repo clone apache/airflow
      

       

      Issue 관리

      issue 명령어를 사용하여 list, create, view 등이 가능합니다.

      gh issue list
      
      
      Showing 30 of 871 open issues in apache/airflow
      
      #18155  Upgrade `importlib-resources` version                            kind:feature                                                    about 14 hours ago
      #18146  Deferred TI's `next_method` and `next_kwargs` not cleared on...  kind:bug, area:core                                             about 15 hours ago
      #18136  Allow airflow standard images to run in openshift utilising ...  kind:feature, area:helm-chart                                   about 18 hours ago
      #18133  bulk_sync_to_db got UnicodeDecodeError when Chinese characte...  Enhancement, good first issue, area:core                        about 42 minutes ago
      
      gh issue create
      
      
      Creating issue in apache/airflow
      
      ? Title
      ? Body 
      ? What's next?  [Use arrows to move, type to filter]
      > Submit
        Continue in browser
        Cancel
      

       

      Pull request

      feature branch 생성 및 commit push 후 pr create 명령어를 사용하여 pull request 를 생성할 수 있습니다.

      gh pr create --head main
      
      
      Creating pull request for main into main in apache/airflow
      
      ? Title
      ? Body 
      ? What's next?  [Use arrows to move, type to filter]
      > Submit
        Continue in browser
        Cancel
      

      그리고 pr merge 명령어를 사용하여 pull request 를 merge 할 수 있습니다.

      gh pr merge 18162
      
      ? What merge method would you like to use? Rebase and merge
      ? What's next?  [Use arrows to move, type to filter]
      > Submit
        Cancel
      

       

      Workflow

      run 명령어를 사용하여 github action 으로 관리되는 ci/cd 상태도 확인 가능합니다.

      gh run list
      
      STATUS  NAME                                       WORKFLOW                       BRANCH                       EVENT                ID          ELAPSED   AGE
      ✓       Add script that validate version field...  Label when reviewed workfl...  main                         workflow_run         1224092992  36s       30m
      ✓       Remove limits for dnspython                Label when reviewed            remove-dnspython-limitation  pull_request_review  1224092925  14s       30m
      -       Add script that validate version field...  Build Images                   main                         push                 1224090687  25m26s    31m
      -       Add script that validate version field...  Tests                          main                         push                 1224090683  11m11s    31m
      ✓       Add script that validate version field...  CodeQL                         main                         push                 1224090682  15m19s    31m
      

       

      결론

      실제 단순 오타 수정의 경우 터미널에서 아래 명령어로 조합으로 github gui 를 이용하는 것보다 훨씬 빠르게 끝낼 수 있습니다.

      gh issue create
      git checkout -b new_branch
      vim file_to_edit
      git add file_to_edit
      git commit -m "Fix typo"
      git push
      gh pr create
      

      그 외 pull request 의 check 및 merge 도 gh 를 이용하면 터미널에서 편하게 할 수 있습니다.

      댓글 0

      DEVOTEE를 활성화 시키면
      지금 작성한 댓글에 AI가 댓글을 달아줍니다.

      onevirus 님의 최신 블로그

      더보기

      관련 블로그

      동영상 기고하기