'Tools/Git'에 해당되는 글 2건

  1. 2022.03.31 Git Hub - markdown
  2. 2021.09.02 Git 사용법
Tools/Git2022. 3. 31. 16:08
728x90

 

Git Hub에서 문서작성 시 팁

 

😀

728x90

'Tools > Git' 카테고리의 다른 글

Git 사용법  (0) 2021.09.02
Posted by 하루y
Tools/Git2021. 9. 2. 23:28
728x90

#Git 사용법
https://roniruny.tistory.com/112
https://git-scm.com/docs
https://git-scm.com/book/ko/v2

Work Directory     Staging Area       Local Repository   Remote Repository
-----------------  -----------------  -----------------  -----------------
[git init]
   @-----[git add]------>
                              @---[git commit]---->
          <------------------[git checkout]---@
                                                        @----[git push]----->
                                                        <-----[git pull]-----@
                                                        <-----[git clone]----@

1. 신규 로컬 리파지토리 생성 및 파일 등록
1) git init                               // 빈 디렉토리를 git 리파지토리로 초기화
2) git add 파일                       // stage에 파일추가
3) git commit                         // stage의 파일을 로컬 리파지토리로 등록함
 $ git commit -m '메시지'

 $ git commit -am '메시지'        // add * commit 을 동시에 처리함.

 

2. branch 생성 및 작업
1) $ git branch new_branch          // branch 생성
2) $ git checkout new_branch       // branch 변경(이동)
3) 파일수정
4) $ git commit -am '메시지'

 

9) branch 명 변경

   $ git branch -m old_branch new_branch

 

3. 상태조회

3.1 파일 상태 확인

 $ git status

3.2 로그 조회

 $ git log --oneline      // --oneline은 메시지를 하나줄만 간략히 표시

 $ git log 파일            // 특정파일의 로그 기록 표시

3.3 로그 상세 내용 조회

 $ git show 커밋ID

3.4 브랜치 조회

 $ git branch --all

  . -r : 원격 브랜치 조회

  . -vv : 트래킹 브랜치 조회

 

4. 원격작업

4.1 서버에 전송하기

1) $ git remote add origin http://github.com/계정/리파지토리명.git    // 원격저장소를 로컬리파지토리에 등록한다.

 - origin: 원격저장소별칭으로 new, backup, fix등으로 정의할 수 있다.

2) $ git remote -v                    // 연결된 원격저장소를 조회한다.

3) $ git push origin 브랜치명     // 연결된 원격저장소(origin라면)로 소스를 전송한다.

 

4.2 서버에서 내려받기

1) $ cd 작업폴더         // clone 하면 디렉토리가 생성된다.

2) $ git clone http://github.com/계정/리파지토리명.git  새디렉토리명

 - 새폴더 이름을 적지 않는 경우, 공개저장소에 사용된 폴더와 동일한 이름으로 새 폴더를 생성함.

 

4.3 브랜치 업로드

1) $ git push -u origin 브랜치명                        // 원격저장소별칭이 origin이면

   $ git push -u origin 브랜치명:변경할브랜치명    // 다른 브랜치명으로 업로드한다. 

 

4.4 브랜치 업데이트

1) $ git pull origin 브랜치명                            // 원격저장소별칭이 origin이면

 

9. 기타작업

9.1 git 프로필 설정
$ git config user.name  "xxx"
$ git config user.email "yy@yy.com


9.2 git 프로필 조회
$ git config user.name
$ git config user.email

9.3 git 사용자이름, 메일 정조 삭제하기
$ git config --global --unset user.name       <-- unset
$ git config --global --unset user.email

 

9.4 git 설정 보기
 $ git config -list --show-origin
 
9.5 git 에디터 설정
 $ git config --global core.editor emacs
 $ git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

 

9.6  git 도움말
 $ git help

 $ git help 명령어
 $ git <verb> --help 
 

728x90

'Tools > Git' 카테고리의 다른 글

Git Hub - markdown  (0) 2022.03.31
Posted by 하루y