관리 메뉴

IT.FARMER

git 명령어 본문

Auto Build(CI SCM GIT)/git

git 명령어

아이티.파머 2018. 11. 26. 20:07
반응형

---------------------------------------------------------------------------------

깃 Bare Hock 사용법 


git --bare init

git remote add {원하는Git서버명} ssh://{USER}@{IP}:{PORT}/{PATH}

git --work-tree=/var/www/manager2 --git-dir=/home/mycup/git/test checkout -f

git remote add remotedev ssh://root@192.168.10.1:7777/


--------------------------------------------------------------------------------

깃 리모트 브렌치 체크아웃 사용법 


깃 리모트 업데이트 

git remote update


원격 브랜치 확인 

git branch -a


branch list Sample 

  develop

  gradletest

  master

* sangkil

  remotes/origin/HEAD -> origin/master

  remotes/origin/dasom

  remotes/origin/develop

  remotes/origin/junyoung

  remotes/origin/master

  remotes/origin/release

  remotes/origin/sanghyun

  remotes/origin/sangkil

  remotes/origin/sejun

  remotes/origin/yoonchul


원격 브랜치 체크아웃 

git checkout -t {원격지branch}

git checkout -t origin/sangkil


-> 옵션없이 사용하면 참고 만 하고 commit / push 할수 없다, 다른 브렌치로 이동시 사라진다. 

----------------------------------------------------

깃 리베이스 방법 


git rebase -i HEAD~2


pick

squash

pick

---------------------------------------------------

툭정 파일 되돌리기 

git log <파일경로/이름>

git checkout <commitId> <파일경로/이름>

git checkout 221aa43b9dc0f22a33bfe02d2dc054798850df2f ./document/photon-report-erd.erm




DSN 체크 

cmd > nslookup > www.naver.com 


-----------------------------------------------------


깃 충돌 시 


Please commit your changes or stash them before you merge


방법 1

stash 사용 


>git stash 

>git pull



방법 2

가장 최근 이력으로 HEAD 이동 

git reset --hard HEAD

git pull


--------------------------------------------------------

SSH Clone 방법 


ssh-keygen -t rsa -C "your.email@example.com" -b 4096

ssh-keygen -t rsa -C "mycup@nate.com" -b 4096


  git clone ssh://${user}@${server_ip}:${port}/${project_path}


git clone ssh://user@server_ip:22/opt/myproject.git


git clone ssh://git@192.168.10.102:7777/photon-report-integration/photon-report.git



반응형