각종 사용법

우분투용 git 사용법

notou10 2022. 3. 16. 11:28

git 바이블

https://www.opentutorials.org/course/2708

 

참고링크 : https://cjh5414.github.io/get-git-remote-branch/

https://thdev.tech/git/2016/12/19/Git-Branch-Name-Change/

Process

1) git branch

2) git checkout hinton-dongkyun

3) 코딩 후 git add *

4) git commit -m "dfdf"

5) git push origin hinton-dongkyun

 

(선택) 마스터랑 병합

git checkout master 이후

git merge hinton-dongkyun

git push origin master

강제로 push 하기

git push -u origin +hinton-dongkyun

 

원격저장소에서 가져오기

1. git checkout hinton

선택지 1) 걍 git pull

선택지 2) git fetch -> git merge

 

가져온거 브랜치의 incoming changes accept

git checkout --theirs [파일명]

 

윤지님꺼 받을때

(yun_ckpt 에서)

git add *

git commit -m "dfdf"

got checkout hinton-dongkyun 

git merge yuns

git push origin master

 

(원격에서 이제 가져옴)

git checkout yuns

git fetch

git merge

git checkout theirs ./*

 

wandb log

# Initialize WandB
if args.wandb:
    wandb.login()
    wandb.init(project=f"{cfg.TRAIN.exp_name.split('/')[0]}", entity="notou10")
    wandb.run.name = cfg.TRAIN.exp_name.split('/')[1]
    wandb.run.save()
    config = wandb.config

 

원격 repo 연결 끊기/ 재연결

gir remote -v 로 현재 연결 확인 

gir remote remove origin 으로 끊기

git remote add origin 새 연결.git fh todusruf

 

 

 

git stash

임시 저장하는거임

git stash

git stash list 하면 이름들 뜸

git stash apply stash{0} 

 

 

원격 저장소에서 처음으로 특정 branch 가져오기

git remote update

git checkout -t origin/yuns

 

220506

로컬에서 삭제 반영

git add -u

git commit -m "erer"

git push origin hinton-dongkyun

220316

 

해당 폴더(workspace/LGD_dk/hinton_dk)에서 

 

브랜치 확인

git branch

 

내 브랜치로 변경

git checkout hinton-dongkyun

 

stage에 add

git add *

 

커밋

git commit -m "dfsdfs"

 

(마스터랑 병합)

git checkout master 이후

git merge hinton-dongkyun

 

git push origin master (or hinton-dongkyun)

 

220324

git checkout branch 하면 내 vscode에서도 해당 branch 의 코드로 바꾸어짐

 

branch 이름 변경하기

git branch -m old_name new_name

#기존 dummy 삭제
git push origin :old_name

#새로운 branch upload
git push --set-upstream origin new_name

 (내 컴에 저장된)원격 branch update

git remote update

 

특정 branch 가져오기

 

.git폴더 내 .git 폴더 지우기

1. find . -name '.git' (로 존재하나 확인)

2. find . -mindepth 2 -name '.git' -prune -exec rm -rf {} +

3. 다시 1 하면 삭제된거 보임

 

로컬, 원격내 존재하는 branch 모두 확인하기

git branch -a