Good References

아래 링크를 통해서 개념을 연습하시면 좋습니다.

https://learngitbranching.js.org/

https://try.github.io/

Window: git 설치

기본적인 workflow 는 다음과 같습니다.

Repository: Repo - 저장소

  1. Local - 내 컴퓨터

  2. Remote - 깃헙 깃버켓

  3. Repository Clone 하기. 원격 Github 에 저장된 저장소를 로컬에 복사해 오는 것.

    $ git clone [remote repository] /path/to/local/directory
    
  4. 본인 branch 만들기. 본인 이름으로 만들 수도 있고, 작업하는 내용에 맞게 만들 수도 있습니다.

    # create branch
    git branch [branch name]
    
    # checkout (change to) the branch
    git checkout [branch name]
    
    # or, do both commands together by
    git checkout -b [branch name]
    
  5. 작업하기

  6. Git staging. 작업한 (따라서 내용이 바뀐) 파일들을 git 에 추가해줍니다.

    git add [file1] [file2] [file3] ...
    
    # To add all files that have been changed,
    git add .
    
  7. Commit. Git 에 추가된 파일들을 commit 해줍니다. (Change 를 저장하는 것과 같은 일)

    git commit -m "commit message"
    
    # 고칠때
    git commit --amend --no-edit
    
  8. Push. 원격 저장소에 본인이 작업한 내용을 업로드 합니다.

    # change to master branch
    git checkout master
    # get the latest version of the code
    git pull
    
    # change to your dev branch
    git checkout [your branch]
    # apply the latest version of the code to your work
    git merge master  # you may wanna use rebase, depending on the situation
    
    # upload your work
    git push -u origin [your branch]
    
    
  9. Push 한 후, 웹으로 해당 깃헙 저장소에 들어가보면

    에서 초록색 Compare & Pull Request 버튼 클릭! (없을 경우, Pull Requests 탭에 들어가면 나옵니다)

    그다음 원하는 메세지를 적은 후 Create Pull Request 버튼 클릭