[Git] 사용 요약
정보

[Git] 사용 요약

반응형

Git 사용 요약





git config --global user.name "이름"
git config --global user.email "깃허브 메일주소" // 매번 물어보는 귀찮음을 피하기 위해 설정.

mkdir ~/MyProject   // 로컬 디렉토리 만들고
cd ~/myproject      // 디렉토리로 들어가서
git init            // 깃 명령어를 사용할 수 있는 디렉토리로 만든다.
git status          // 현재 상태를 훑어보고
git add 화일명.확장자  // 깃 주목 리스트에 화일을 추가하고 or
git add .           // 이 명령은 현재 디렉토리의 모든 화일을 추가할 수 있다.
git commit -m “현재형으로 설명” // 커밋해서 스냅샷을 찍는다.

git remote add origin https://github.com/username/myproject.git // 로컬과 원격 저장소를 연결한다.
git remote -v // 연결상태를 확인한다.
git push origin master // 깃허브로 푸시한다.


git commit

1. mkdir myfolder

2. cd myfolder

3. git init

4. vi test.txt

5. i

6. “hello git”

7. esc

8. :wq

9. git status (stage 올리기 전)

10. git add test.txt (stage에 올린다)

error

warning: LF will be replaced by CRLF in “파일이름”

solution

윈도우 : $ git config --global core.autocrlf input
맥,리눅스 : $ git config --global core.autocrlf true

11. git status (stage에 올린 후)

12. git commit -m “commit message”

git push

1. git remote add [remoteName] https://github.com/[userID]/[repositoryName]

2. git remote -v (원격 저장소명 확인하기)

3. git push [remoteName] master

summary

  1. git add .
  2. git commit -m ‘commit message’
  3. git push origin master


반응형