IT STUDY LOG

simple git log 본문

devops bootcamp 4/pair/team log

simple git log

roheerumi 2023. 3. 21. 18:04

#TROUBLE SHOOTING LOG

📝 문제점 1 : push가 정상적으로 되지 않았던 상황

  • 원인 : git push를 할 때 원격 레파지토리 주소와 브랜치명을 명시하지 않아 발생
  • 해결 방법 : git push <저장소명> <브랜치명>을 명시
    • (ex) git push origin master
    • (ex) git pull pair master
  • 알게된 사실
    • git은 repository를 만들면 기본 브랜치로 master(or main)을 만듦
    • origin : git의 alias로 ./git/config 파일에 설정되어 있음
      • (ex) origin.url = 내 git 레파지토리 url
      • (ex) pair.url = 페어 git 레파지토리 url
# git의 local config 파일 : .git/config
roheerumi@devops:~/devops/git_study/.git$ pwd
/home/roheerumi/devops/git_study/.git
roheerumi@devops:~/devops/git_study/.git$ cat config 
[core] # 카테고리
	repositoryformatversion = 0 # 변수명 = 값
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = git@github.com:본인id/sprint-simple-git-workflow.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
[remote "pair"]
	url = git@github.com:페어id/sprint-simple-git-workflow.git
	fetch = +refs/heads/*:refs/remotes/pair/*

# git의 global config 파일 : ~/.gitconfig
roheerumi@devops:~$ pwd
/home/roheerumi
roheerumi@devops:~$ cat ./.gitconfig 
[user]
	name = 유저명
	email = 이메일

# 현재 설정된 global, local 변수 모두 확인
roheerumi@devops:~/devops/git_study/sprint-simple-git-workflow/.git$ git config --list
user.name=roheerumi
user.email=내id@gmail.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=git@github.com:내id/sprint-simple-git-workflow.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.pair.url=git@github.com:페어id/sprint-simple-git-workflow.git
remote.pair.fetch=+refs/heads/*:refs/remotes/pair/*

출처 : https://kotlinworld.com/302

 

[git] local, global config 파일의 구성과 조작

git config 파일의 위치 global config 파일의 위치 git의 global config 파일은 ~/.gitconfig 에 있다. git의 local config 파일의 위치 git의 local config 파일은 .git/config 에 있다. git config 파일의 구성 git config 파일은

kotlinworld.com

 

📝 문제점 2 : 페어 중 한명의 pull 과정에서 merge가 되지 않고 fetch만 되어서 충돌이 발생하지 않음

  • 원인 : git 상위 버전의 경우 pull 정책을 따로 지정하지 않을 경우 merge가 되지 않음
    • 나 : git version 2.25.1
    • 페 : git version 2.34.1
  • 해결 방법
    • pull을 할 때마다 정책을 지정
    • git config --global pull.rebase false를 통해 기본 전략을 merge로 변경
  • 배운 것
    • git pull 전략
      • default (merge) : 로컬 브랜치와 리모트 브랜치의 Head가 다른 위치에 있을 때, pull 받으면, Merge 커밋을 생성함.
      • rebase : 로컬 브랜치와 리모트 브랜치의 Head가 다른 위치에 있을 때, pull 받으면, 리모트 브랜치를 rebase 하여 history를 정리함.
      • fast-forward only : fast-forward 관계에 있을 때만 pull 을 허용함.

출처 : https://younho9.dev/git-config

'devops bootcamp 4 > pair/team log' 카테고리의 다른 글

Sprint - Cozstory WAS 개발  (0) 2023.03.28
Mini WAS 개발 hands-on  (0) 2023.03.28
CozStory 클라이언트 호스팅  (0) 2023.03.27
nginx Web Server Hands-on  (0) 2023.03.24
블로그 애플리케이션 REST API 작성  (0) 2023.03.23
Comments