본문 바로가기
개발팁

GitHub 터미널로 사용하기

by 몸에배인매너 2022. 2. 2.
git init     #이 공간과 연동

git add     #모든 파일 추가

git commit -m "first commit"     #커밋작성

git branch -M main     #브랜치 작성

git remote add origin (git주소)     #github와 연동

git push -u origin main     #원격저장소로 푸쉬

 

github 에 불필요한 파일이 추가되었을 때

.gitinore 을 수정한뒤

git rm --cached -r .     #원격 파일 수정
git add .
git commit -m 'igore 수정'

 


* cmd 매크로 이용

pull.cmd 파일을 만들어서 붙여넣는다.

@echo off
@REM 0 ) UTF-8 set up.
chcp 65001
git branch -a
@REM 1 ) initialize.
echo 1) 초기화.
git init
@REM 2 ) Enumerate All project Branches.
echo 2) 모든 브랜치들을 나열합니다.
git branch -a
@REM 3 ) Remote to Project.
echo 3) 깃-허브 프로젝트를 로컬로 리모트 합니다.
git remote add origin https://github.com/깃주소
@REM 4 ) Enter the pulling branch name.
echo 4) pull할 branch의 이름을 입력해주세요.
set /p pull_branch_name=Enter pull branch name :
git pull origin %pull_branch_name%
@REM 5 ) All Resources Pulled on Local Storage.
echo 5) 모든 resorce들이 local상에 pull 되었습니다.
pause

터미널에 pull.cmd 입력

 

push.cmd

@echo off
@REM 0 ) UTF-8 set up.
chcp 65001
git branch -a
echo - - - Start push.cmd terminal - - -
@REM 1 ) initialize.
echo 1 ) 현재 폴더를 초기화합니다.
git init
@REM 2 ) add contents.
echo 2 ) 로컬 내의 모든 파일을 추가합니다.
git add .
@REM 3 ) remote project to local
echo 3 ) 프로젝트 리모트.
git remote add origin https://github.com/깃주소
@REM 4 ) Commit Contents Input Area.
echo 4 ) 커밋 내용을 입력하시오.
set /p commit_Contents=Enter what you want to commit :
@REM 5 ) Commit Contents Send Information.
echo 5 ) 커밋 합니다.
git commit -m %commit_Contents%
@REM 6 ) push Contents to branch Input Area.
echo 6 ) 푸쉬할 브랜치를 입력하주십시오.
set /p branch_location=Enter where you push to branch :
@REM 7 ) Commit Content push Area.
echo 7 ) 해당 브랜치에 푸쉬합니다.
git push -u origin %branch_location%
@REM 8 ) push completed message,
echo %branch_location%에 리소스들을 push 하였습니다.
echo - - - End push.cmd terminal - - -
pause

 

cleaner.cmd

@echo off
chcp 65001
@REM 원격 저장소와 로컬 저장소 브랜치 동기화.
echo 원격 저장소와 로컬 저장소 브랜치 동기화합니다.
git fetch --all --prune
@REM 원격 저장소와 로컬 저장소 브랜치 동기화 후 종료.
echo 원격 저장소와 로컬 저장소 브랜치 동기화를 끝냅니다.

 

switcher.cmd

@echo off
git branch -a
@REM 1 ) switch_branch_name_input section.
set /p switch_branch_name=Enter the switch branch name :
@REM 2 ) Commit Contents Send Information.
git checkout %switch_branch_name%

'개발팁' 카테고리의 다른 글

Override, Method (메소드) 란  (0) 2022.02.16
Django 심화과정 듣기 전 기본 개념  (0) 2022.02.15
Django 데이터베이스 초기화  (0) 2022.01.21
파이참 사용시 단축키, 키보드 사용법  (0) 2022.01.19
Flask Blueprint  (0) 2022.01.13

댓글