코딩일상

[Git,GitHub] git기본 사용방법 및 명령어 정리 본문

개발 공부

[Git,GitHub] git기본 사용방법 및 명령어 정리

solutionMan 2022. 12. 31. 01:40
반응형

git 설치 확인하기+ 버전확인

git --version

 

위 명령어를 통해 나온것이 없다면 git을 설치해야한다.

 

Git - Downloads

Downloads macOS Windows Linux/Unix Older releases are available and the Git source repository is on GitHub. GUI Clients Git comes with built-in GUI tools (git-gui, gitk), but there are several third-party tools for users looking for a platform-specific exp

git-scm.com

 

git 세팅설정 확인방법

git config --list

나가고 싶다면 q 입력

 

git 세팅설정 을 파일로 확인을 해보고싶다면

git config --global -e

나가고 싶다면 :q 입력

 

 

터미널에서 편집을 하는게 불편하다면 VsCode(VisualStudioCode)에서도 사용이 가능

code .

 

만약 VsCode가 설치가안되어있으면 설치후 적용

설치후에도 연결이 안되면 구글에 자료가 많으니 검색

 

 

 

VsCode에서 편집중 다른일이을 하지 못하게 설정하는 법

git config --global core.editor "code --wait"

 

 

 

git config 수정방법 예시

git config --global user.name "name"

git config --global user.email "test@gmail.com"

 

 

 

git config 수정확인방법

git config user.name

git config user.email

 

 

 

git config --global core.autocrlf 설정

//윈도우
git config --global core.autocrlf true

//맥
git config --global core.autocrlf input

 

 

폴더를 만드는 방법

mkdir 폴더명

예시) 폴더명 gitprc라는 폴더를 만드는법

mkdir gitprc

 

현재 경로에 있는 모든 파일들을 보는법(숨겨진 파일까지)

ls -al

 

현재경로를 확인하는법

pwd

예시결과)/user/test

 

경로 이동하는법

cd 이동할 경로

예시)  /user/test에서 /user/test/gitTest로 가고싶다면

cd gitTest

 

파일을 탐색기로 열어보는법

open 열고싶은 파일명

예시)  열고싶은 파일명 gitprc라면

open gitprc

 

git을 초기화 + 설치하는법

git init

 

숨겨진파일 보는 단축키

shift +command + . 

 

branch 관련 명령어

 

git branch 확인

git branch -a

 

git branch 삭제(local Repository)

git branch -d {브랜치명} 

 

git branch 삭제(Remote Repository)

git push origin --delete  {브랜치명} 

 

 

git 에러 해결 명령어

에러 

fatal: refusing to merge unrelated histories 

git pull origin 브런치명 --allow-unrelated-histories

 

 

 

아직 미완성입니다.

계속 수정 보완주이니 참고바랍니다

 

 

 

 

 

반응형

'개발 공부' 카테고리의 다른 글

ANSI SQL 이란??  (0) 2023.01.07
[SQL] SQL명령어 정리(공부한 것 정리 중)  (0) 2023.01.03
mongoDB 비밀번호 분실 및 변경  (0) 2022.12.05
왜 nginx를 쓰나?? 알고 쓰자??  (1) 2022.09.25
CI/CD란??  (0) 2022.09.08
Comments