본문 바로가기

About my life/Development Studies

What is git

728x90
반응형

What is git ?

  • By far, the most widely used modern version control system in the world today is Git
  • 모든 개발자가 작업한 코드 복사본의 저장소
  • 일반적으로 소프트웨어 개발에서 소스 코드 관리에 사용됨

Fig1. Git system

  • 개발중에 있는 모든 작업의 history를 저장,공유하여 편리한 코드 수정,관리 및 협업을 가능하게 해주는 framework 

 

Git workflow ?

  • Working directory : modify files in my working directory
  • Staging area (index) : stage the files and add snapshots of them to my staging area
  • Git directory (repository) : perform a commit that stores the snapshots permanently to my Git directory.

Fig 2. Git workflow

  • 아래는 제가 이해한 GIT 입니다.
  • Working Directory는 Local computer 저장소라고 생각하면 될듯
  • Staging Area는 파일의 수정사항을 저장하는 임시 저장하는 공간
  • Git Directory는 staging area에 있는 수정사항에 coment를 붙여서 저장하고, 그것을 branch 에 연결해둔다.

 

what is checkout ? 

 

Git branch ? 

  • Branch in Git is used to keep your changes until they are ready
  • I can do my work on a branch while the main branch (master) remains stable
  • Ater i am done with my work, i can merge it with the main office

Fig 3. Branch in Git

  • Once i am finished working with the two separate branches, i can merge them and create a master branch
  • branch에 연결하면 기존에 수정사항들을 어디에 보관할 지 결정할 수 있음
  • 여러 개의 branch를 테스트, 개발 , 배포, 실험 등등으로 나누어서 commit 을 관리할 수 있음

Git command

  • git init  : Initializing a repository to my folder. Whenever a Git repository is created for the first time, it creates a branch, and the name of the branch is master.
  • git add : git이 local 컴퓨터에 있는 파일의 수정사항을 임시 저장소에 저장. (staging area
  • git commit : staging area에 친구들을 모두 하나의 snap shot으로 묶어서 (git directory),(branch에 연결)
  • git status : 생성된 파일의 상태
  • git log : 커밋에 대한 모든 정보 확인
  • git remote add origin URL : 원격 저장소 추가
  • git remote -v : 원격 저장소 확인
  • git push : Pushing is the way commits are transferred from the local repository to the remote repository

Fig 4. Git push

  • git --version : Git 버전 확인
  • git status 
  • git config -- global user.name "--"
  • git config -- global user.email "---.net"
  • git config --list

-> 자주 사용하는 명령어

  • git remote add origin URL
  • git add *
  • git commit -m "first commit"
  • git push -u origin main

-> 다른 개발자와 함께 작업하는 경우 누가 코드를 체크인 및 체크아웃, 변경 하는 지 알아야 함

  • git diff : 마지막 커밋 이후의 차이점
  • git branch second : creates a branch. sencond branch를 생성하고 이를 main branch 에 병합함
  • git checkout second : switches to the new branch from the master branch.
  • git merge second : 가리키고 있는 branch와 sencod branch를 병합한다

 

Git Features

  • Tracks history
  • Supports collaboration
  • Distributed development
  • Creates backups
  • Git 을 공부하다 보니 위 네가지 특징이 완벽히 이해가네요.

 

 

Reference : https://www.simplilearn.com/tutorials/git-tutorial/what-is-git

 

728x90
반응형

'About my life > Development Studies' 카테고리의 다른 글

[Error] Python  (0) 2023.06.14
[Backend] 기업 분석 연습  (0) 2023.06.08
[Backend] 백엔드 개발자 직무 이해  (0) 2023.06.08
[Backend] 백엔드 개발자 전망  (5) 2023.06.07
[SW] 소프트웨어 산업  (0) 2023.06.07