Git

Git 설정 및 기본

Michelle Hwang 2021. 3. 18. 15:33

git{명령어}{옵션}{웹주소}

 

 

Michellehwang001/SeminStudy

Flutter. Contribute to Michellehwang001/SeminStudy development by creating an account on GitHub.

github.com

 

1. git config --global user.name "Michelle Hwang" //난 이렇게

2.git config --global user.email "your_email@youremail.com" //이메일 바꿔넣으시고

3. github 로 이동. Repository 만들기

4. 터미널에서 readme.md 파일 만들고

5. 터미널에서 다음과 같이 입력..

git init

git add readme.md 

git commit -m "first commit"

git branch -M main  //기존 동일한 이름의 branch가 있더라도 덮어쓴다. 

git remote add origin https://github.com/Michellehwang001/SeminStudy.git

git push -u origin main  //git push <remote> <branch>

 

 

6. ID , 패스워드를 입력하면 gitHub에 올라간다.

 

7. 기타..

# git remote -v // 로컬 저장소가 알고 있는 원격 origin에 대한 모든 항목을 보여준다.

 

# git remote remove origin // 만약 저장소가 잘못 되어 있다면 .....   로컬 저장소 날리기.. 

 

# git branch -M sub1 // sub1 브렌치를 만든다. 

 

# git branch -m sub1 // sub1 브렌치로 변경, sub1브렌치를 사용하겠다. 

 

# git config --global --list // 현재 설정된 config 리스트

 

# git pull : 변경된 것 가져오기

# git clone : 모든 것 가져오기

# git clone https://github.com/Michellehwang001/SeminStudy.git  

 

//2021. 3. 19 추가

# git rm first_flutter // first_flutter 폴더를 날려버림..

 

//2021. 3. 24 추가

# git branch //현재 브랜치를 보여준다.

# git checkout sub2 // sub2브랜치로 이동한다.

# git checkout -b 브랜치명 commitID // commitID로 돌아가며 브랜치가 생긴다.

# git branch 브랜치이름 // 브랜치이름으로 브랜치가 분기된다.

# git reset --HARD // reset은 거의 안씀

# git reset --SOFT

# git branch -d <branchname> //브랜치 삭제

 

# git merge <branch> // Merge 할 위치로 이동 후 실행 ex> git checkout main / Merge 후 Push