2. 깃 이론 정리 (1)

Dec 12, 2023
2. 깃 이론 정리 (1)

 

1. 프로젝트 생성하기

FileNewProject... 에서 생성할 수 있다.
notion image
 

2. 터미널 실행하기

터미널 아이콘을 클릭하여 실행한다.
notion image
 

3. 깃 명령어 사용하기

  1. ls -a
git의 파일들을 확인하는 명령어.
notion image
 
  1. ls -al
git의 파일들을 세부적으로 확인하는 명령어. d로 시작하면 폴더, -로 시작하면 파일.
notion image
 
  1. git init
새로운 git 저장소를 생성하는 명령어. git init를 사용할 시 이전 데이터는 삭제되므로 git add로 기록하여야 한다.
notion image
 
  1. git add
현재 상태를 기록하는 명령어. git add 뒤에 '.'를 입력하면 전체를 기록한다. git add를 한번 더 실행하게 되면 덮어 씌워진다.
notion image
 
덮어 씌워지지 않으려면 저장해야 한다.
 
저장하는 명령어는 commit이다.
 
  1. git commit
실행 명령어는 git commit -m ""
notion image
 
💡
사용자 등록 없이 commit을 입력하면 에러가 발생한다.
 
commit 사용자 등록 명령어
git config --global user.email "[you@example.com](mailto:you@example.com)" git config --global [user.name](http://user.name/) "Your Name"
notion image
 
사용자 등록을 하면 commit을 사용할 수 있다.
 
  1. git log
기록을 불러오는 명령어.
notion image
 
  1. 삭제
삭제하는 명령어는 rm.
notion image
 
💡
폴더를 삭제할 때에는 -r을 입력한다.
 
삭제하고 생성하는 방법 다시 정리할 것
 

3. 깃허브와 연결

 
  1. 깃허브와 연결
git remote add origin <연결할 깃헙 도메인>
notion image
 
  1. 깃허브에 업로드
git add. git commit -m "" git push origin master
notion image
notion image
notion image
 
  1. 원격저장소 정보 확인
git remote -v
notion image
 
  1. 원격저장소 추가
git remote add origin <추가할 저장소의 url>
 
💡
명령을 입력하던 도중에 중단하고 싶을 때는 ctrl+c를 입력한다.
 
 
 
Share article

oncehyun