'프로그램 사용/Version Control'에 해당되는 글 134건

  1. 2018.10.18 git 리비전 돌아 다니기
  2. 2018.09.20 git 상태 다시 읽기
  3. 2018.09.06 git 원격지 주소 변경하기
  4. 2018.09.05 git archive (svn export)
  5. 2018.08.22 git rm 복구하기
  6. 2018.08.22 git branch
  7. 2018.08.22 git add / reset / checkout
  8. 2018.08.20 git 커밋이 안될 때? (no changes added to commit)
  9. 2018.08.14 git st (alias 사용하기)
  10. 2018.08.14 git status -s

checkout을 이용해서 특정 리비전을 돌아 다닐수 있다.

예전에 branch 오가던 느낌이네..


git checkout HEAD~10

git checkout master 

[링크 : https://mytory.net/archives/10078]

'프로그램 사용 > Version Control' 카테고리의 다른 글

.gitignore  (0) 2018.10.22
git 리비전 이동 후 pull 안되는 문제  (0) 2018.10.22
git 상태 다시 읽기  (0) 2018.09.20
git 원격지 주소 변경하기  (0) 2018.09.06
git archive (svn export)  (0) 2018.09.05
Posted by 구차니

가끔(?) status 하면 새로 추가되거나 수정된 파일이 안뜰때가 있는데

이거 해주면 새로 읽어서 status에 뜨게 해준다.


$ git update-index --again 

[링크 : https://stackoverflow.com/questions/10006462/refresh-staged-files]

'프로그램 사용 > Version Control' 카테고리의 다른 글

git 리비전 이동 후 pull 안되는 문제  (0) 2018.10.22
git 리비전 돌아 다니기  (0) 2018.10.18
git 원격지 주소 변경하기  (0) 2018.09.06
git archive (svn export)  (0) 2018.09.05
git rm 복구하기  (0) 2018.08.22
Posted by 구차니

git remote set-url origin을 통해서 변경함

 

$ git remote -v
$ git remote set-url origin https://github.com/user/repo2.git 

 

[링크 : http://minsone.github.io/git/github-managing-remotes-changing-a-remotes-url]

 

+

23.11.13

기존 리포지토리 remote 제거
git remote remove origin

새 리포지토리 remote 추가
git remote add origin https://github.com/계정/리포지토리

[링크 : https://gist.github.com/480/4681b67d2a906db8c6c1321cc678f05f]

'프로그램 사용 > Version Control' 카테고리의 다른 글

git 리비전 돌아 다니기  (0) 2018.10.18
git 상태 다시 읽기  (0) 2018.09.20
git archive (svn export)  (0) 2018.09.05
git rm 복구하기  (0) 2018.08.22
git branch  (0) 2018.08.22
Posted by 구차니

svn export 하면 다른 디렉토리로 사본을 복사해주었는데

git에도 있을 것 같아서 찾아보니 git archive로 존재


[링크 : https://stackoverflow.com/questions/160608/do-a-git-export-like-svn-export]



git archive --format zip --output /full/path/to/zipfile.zip master  

[링크 : https://gist.github.com/kristofferh/1442717]

[링크 : https://git-scm.com/docs/git-archive]

'프로그램 사용 > Version Control' 카테고리의 다른 글

git 상태 다시 읽기  (0) 2018.09.20
git 원격지 주소 변경하기  (0) 2018.09.06
git rm 복구하기  (0) 2018.08.22
git branch  (0) 2018.08.22
git add / reset / checkout  (0) 2018.08.22
Posted by 구차니

git rm 으로 삭제한 파일은 두단계를 거쳐서 복구해야 한다.

git reset HEAD <filename>

git checkout -- <filename> 

[링크 : https://stackoverflow.com/questions/11727083/how-to-recover-file-after-git-rm-abc-c]


+

$ git rm style.css

rm 'web/css/style.css'


$ git st -s

D  style.css


$ git reset HEAD style.css

Unstaged changes after reset:

D       web/css/style.css


$ git st

 D style.css


$ git checkout -- style.css


$ ll

total 12

-rw-r--r-- 1 user 197121 1831 8월  22 10:52  style.css 


'프로그램 사용 > Version Control' 카테고리의 다른 글

git 원격지 주소 변경하기  (0) 2018.09.06
git archive (svn export)  (0) 2018.09.05
git branch  (0) 2018.08.22
git add / reset / checkout  (0) 2018.08.22
git 커밋이 안될 때? (no changes added to commit)  (0) 2018.08.20
Posted by 구차니

실습을 따라해보니 조금 감이 잡히는 듯..

일단 브랜치 간에는 commit 되지 않은 수정이 사항이 있을때에는 이동이 불가하다

$ git st -s

 M myfile.txt


$ git checkout issue1

error: Your local changes to the following files would be overwritten by checkout:

        myfile.txt

Please commit your changes or stash them before you switch branches.

Aborting 


git merge는 합병할 다른 브랜치를 "끌어온다"

즉, master에 다른 브랜치를 합치려면 master에서 다른 브랜치를 끌어와야 한다.

$ git merge 다른브랜치이름 

[링크 : https://backlog.com/git-tutorial/kr/stepup/stepup1_1.html]


+

svn과 다른 점이라고 하면..

일단 svn은 다른 경로의 것을 checkout 받거나, 새로운 경로에 받아서 쓰는 개념이라면

git은 현재 저장소에서 다른 경로의 것을 내부적으로 관리하여 오간다는 개념?



+

브랜치 따서 commit 하고 push 하려는데 에러 발생!

$ git push

fatal: The current branch test has no upstream branch.

To push the current branch and set the remote as upstream, use


    git push --set-upstream origin test 


svn과 다르게 git는 저장소에 다가 branch에 올린다고 알려주어야 하는 듯

(어짜피 svn에서 tags나 branch도 폴더니까 별 의미없었지만) 어떤 의미로는... cvs에 좀 더 가까운 느낌?


로컬 저장소에서 변경된 사항들을 리모트 저장소에 반영할 때에는 push 명령어를 통해 할 수 있는데 처음 push를 할 경우 해당 로컬 브랜치가 어느 리모트 브랜치에 push해야하는지 알려줘야 한다. 

[링크 : https://lee-seul.github.io/git/2017/01/27/git-for-team-teams-of-one.html]

'프로그램 사용 > Version Control' 카테고리의 다른 글

git archive (svn export)  (0) 2018.09.05
git rm 복구하기  (0) 2018.08.22
git add / reset / checkout  (0) 2018.08.22
git 커밋이 안될 때? (no changes added to commit)  (0) 2018.08.20
git st (alias 사용하기)  (0) 2018.08.14
Posted by 구차니

파일 생성/수정 -> untracked

untracked -> git add -> stage

stage -> git reset -> untracked/unstage

$ touch ss

$ git st -s

?? ss

$ git st

On branch master

Untracked files:

  (use "git add <file>..." to include in what will be committed)


        ss


nothing added to commit but untracked files present (use "git add" to track)

$ git add ss

$ git st

On branch master

Changes to be committed:

  (use "git reset HEAD <file>..." to unstage)


        new file:   ss


$ git st -s

A  ss

$ git reset ss

$ git st -s

?? ss


---

$ git checkout 명령은 어떻게 보면..

$ git status -s 와 비슷한 결과가 나오네..?

별다르게 파일을 수정하거나 받아오지 않고 단순하게 현재 상황만 보여준다.


대신 파일이름을 적어주면

$ git checkout filename

수정된 파일을 저장소에 관리되는 버전으로 끌어오게 된다.(수정사항이 사라짐)

svn으로 치면.. 파일 삭제하고 checkout 하는 느낌?


$ rm myfile.txt

$ ll

total 0

$ git st -s

 D myfile.txt

$ git checkout

D       myfile.txt

$ ll

total 0

$ git checkout myfile.txt

$ ll

total 1

-rw-r--r-- 1 classact 197121 49 8월  22 10:15 myfile.txt 

[링크 : https://www.zerocho.com/category/Git/post/581b7122809622001722fc0b]

[링크 : https://backlog.com/git-tutorial/kr/stepup/stepup2_1.html]


+

git 도움말 추출

svn의 checkout과는 용도가 다르군..

git-checkout - Switch branches or restore working tree files 


'프로그램 사용 > Version Control' 카테고리의 다른 글

git rm 복구하기  (0) 2018.08.22
git branch  (0) 2018.08.22
git 커밋이 안될 때? (no changes added to commit)  (0) 2018.08.20
git st (alias 사용하기)  (0) 2018.08.14
git status -s  (0) 2018.08.14
Posted by 구차니

tortoiseGIT으로 하면 알아서 add + commit 하는건진 모르겠지만

파일을 수정하고 git bash에서 commit 하려고 하니 아래와 같은 에러가 발생한다.

$ git commit

On branch master

Your branch is up to date with 'origin/master'.


Changes not staged for commit:

        modified:   web/pagelet/login.html


no changes added to commit 


아무튼.. add 하고 하면 M의 위치가 서로 달라지는데 stage의 의미를 아직 이해 못해서 그런걸지도...

$ git st

 M login.html 

$ git add login.html

$ git st

M  login.html


[링크 : https://blog.outsider.ne.kr/1247]


staging을 좀 더 봐야겠다.. ㅠㅠ

[링크 : https://blog.npcode.com/2012/10/23/git의-staging-area는-어떤-점이-유용한가/]

[링크 : http://resoneit.blogspot.com/2013/10/git-stage-area.html]



지금 다시 보니 조금 이해가 되네.. 일단 modified 하고 나서도 staged 상태로 가지 않으면 commit이 되지 않는다.

svn에서는 수정하면 modified = staged 개념이었는데

git 에서는 modifed 되었다고 하더라도 개인 수정을 인정하고 무조건 업데이트 안하는 구조라 그런건가?

[링크 : https://git-scm.com/book/ko/v1/Git의-기초-수정하고-저장소에-저장하기]

'프로그램 사용 > Version Control' 카테고리의 다른 글

git branch  (0) 2018.08.22
git add / reset / checkout  (0) 2018.08.22
git st (alias 사용하기)  (0) 2018.08.14
git status -s  (0) 2018.08.14
git mv 와 log  (0) 2018.08.14
Posted by 구차니

svn에서는 콘솔에서 사용할때 약어를 많이 사용했는데

git에서는 지원하지 않고 대신 alias를 통해서 간결하게 사용이 가능하다.


$ git config --global alias.co checkout

$ git config --global alias.br branch

$ git config --global alias.ci commit

$ git config --global alias.st status 

[링크 : https://git-scm.com/book/ko/v2/Git의-기초-Git-Alias]

'프로그램 사용 > Version Control' 카테고리의 다른 글

git add / reset / checkout  (0) 2018.08.22
git 커밋이 안될 때? (no changes added to commit)  (0) 2018.08.20
git status -s  (0) 2018.08.14
git mv 와 log  (0) 2018.08.14
git mv  (0) 2018.08.13
Posted by 구차니

짧게 보는 방법


옵션없이 사용하면 먼가 복잡하게 나오는데

svn 스타일로 간결하게(?) 보려면 -s나 --short 옵션을 주면된다.


git 설정을 통해서 기본값을 변경하면 옵션 없이도 사용 가능하다.


git config status.short true 

[링크 : https://stackoverflow.com/questions/2927672/how-can-i-get-git-status-to-always-use-short-format]



+

2018.08.22

저장소 별로 저장되는 건지 새로운 저장소 만들어서 하니 -s 옵션이 누락되어 있다.

전역 설정으로 가능하진 않으려나?

'프로그램 사용 > Version Control' 카테고리의 다른 글

git 커밋이 안될 때? (no changes added to commit)  (0) 2018.08.20
git st (alias 사용하기)  (0) 2018.08.14
git mv 와 log  (0) 2018.08.14
git mv  (0) 2018.08.13
우분투에서 GIT 사용방법  (2) 2018.04.24
Posted by 구차니