CAFE

카테고리가 없는 글

Git 정리 git 도움말 git 사용방법

작성자운영자|작성시간18.03.18|조회수1,767 목록 댓글 0

#kimtheho

 

 

깃 충돌난 file 목록 확인하기:

git diff --name-only --diff-filter=U

 

깃 메시지 한영 사전:



관계 없는 커밋 내역의 병합을 거부합니다(refusing to merge unrelated histories) 조치:
git pull origin

--allow-unrelated-histories

Git remote 저장소 아이디와 패스워드 입력:
git push https://username:password@myrepository.biz/file.git --all

OSX에서 source tree로 push 사용할 때 설정해줘야하는 설정 값:
git config —global credential.helper osxkeychain

 

원격 저장소 URL 수정하기:

git remote set-url origin http://192.168.2.203/something.git

 

원격 저장소 정보보기:

git remote -v

 

최신 걸로 덮어쓰기(복구가 불가 하오니 어쩔 수없을 때만 사용하시고, 반드시 백업 후 사용하세요!!! 리모트서버까지 영향을 줍니다):

'error: 병합 때문에 추적하지 않는 다음 작업 폴더의 파일을 덮어씁니다:' 와 같이 나온 경우, 덮어쓰기하고 싶을 때 사용

git fetch --all
git reset --hard origin/master

 

git log 시, 한글 깨짐

set LC_ALL=C.UTF-8

git config --global core.quotepath false

 

 

현재 branch 이름보기

$ git branch

or

git branch --show-current

 

 

특정 파일 보기

git log -p abc.txt

 

계정 저장하기

(보안은 중요하지 않고 매번 입력하기 귀찮을 때 사용. Windows가 아니라면 일반적으로 Git계정이 저장 되지 않음.)

git config credential.helper store

 

 

git 디렉토리 대소문자 반영 안 되는 게 기본값. 폴더 대소문자 반영되도록 하기:

git config core.ignorecase false
or
git config --global core.ignorecase false

 

git file 변경 내용 확인하기

git diff HEAD example.txt

.gitignore가 안 먹힐 때

git rm -rf --cached .
git add .

git 특정 상태로 변경하기

git checkout 4자리 이상 hash

 

git 특정 상태(커밋)끼리 비교하기

$ git diff {4자리 이상 hash 1} {4자리 이상 hash 2} <-중가로는 지우고해야 함.

 

 

원격 branch 삭제하기 예)

git push origin -d dev


push할 원격서버를 여러개 설정하기

git remote set-url --add --push origin http://domain.com/xxx.git

 

일반 git을 bare 저장소로 변경하기

https://stackoverflow.com/questions/2199897/how-to-convert-a-normal-git-repository-to-a-bare-one

결론만 말하면 .git 폴더만 복사해서 bare로 설정해주면 끝이다. 

$ cd repo
mv .git ../repo.git # renaming just for clarity
cd ..
rm -fr repo
cd repo.git
git config --bool core.bare true

 

git commit 수정

git commit --amend

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

다음검색
현재 게시글 추가 기능 열기
  • 북마크
  • 공유하기
  • 신고하기

댓글

댓글 리스트
맨위로

카페 검색

카페 검색어 입력폼