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

  1. 2018.08.22 git rm 복구하기
  2. 2018.08.22 git branch
  3. 2018.08.22 git add / reset / checkout
  4. 2018.08.20 git 커밋이 안될 때? (no changes added to commit)
  5. 2018.08.14 git st (alias 사용하기)
  6. 2018.08.14 git status -s
  7. 2018.08.14 git mv 와 log
  8. 2018.08.13 git mv
  9. 2018.04.24 우분투에서 GIT 사용방법 2
  10. 2017.12.20 svn 로그 수정 pre-revprop-change

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 구차니

git mv

를 이용하여 파일을 옮기면 원칙적으로는 지우고 새로 추가하는 것과 동일하다는데


사실 git mv 명령은 아래 명령어를 수행한 것과 완전 똑같다.


$ mv README.md README

$ git rm README.md

$ git add README 

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


그렇다고 완전히 삭제하고 더하는것과는 조금 다르게 이어지긴 이어 지는 듯

단, 옵션을 통해서 콘솔에서 봐야 한다는 단점아닌 단점?

거북이 에서는 하단의 Show Whole Project를 하면 이전의 이동전 내역이 보이게 되고


콘솔에서는 --follow 옵션을 통해 이어서 볼 수 있다

(단, 특정 파일을 지정해야 한다)

$ git log --follow

fatal: --follow requires exactly one pathspec 


[링크 : https://stackoverflow.com/.../is-it-possible-to-move-rename-files-in-git-and-maintain-their-history]

  [링크 : https://stackoverflow.com/...git-log-not-show-history-for-a-moved-file-and-what-can-i-do-about-it]


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

git st (alias 사용하기)  (0) 2018.08.14
git status -s  (0) 2018.08.14
git mv  (0) 2018.08.13
우분투에서 GIT 사용방법  (2) 2018.04.24
svn 로그 수정 pre-revprop-change  (0) 2017.12.20
Posted by 구차니

아직 익숙하지 않아서 그런데

git는 svn 에서 처럼 repo browser 등에서 편하게 옮기는 법이 없는 듯..

콘솔에서 다 명령어 칠거면 tortoiseGIT 이런게 필요 없자나.. ㅠㅠ


아무튼 파일을 옮기는건 git mv를 통해서 가능

빈 디렉토리는 옮길수 없고,

git 콘솔에서(git bash 등) git mv를 하고 나서

git commit을 하면 끝


그리고 정리가 끝난 이후에 끝난 녀석만 origin에 push 하면 된다.

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

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

git status -s  (0) 2018.08.14
git mv 와 log  (0) 2018.08.14
우분투에서 GIT 사용방법  (2) 2018.04.24
svn 로그 수정 pre-revprop-change  (0) 2017.12.20
svn externals commit 제외하기  (0) 2017.12.10
Posted by 구차니

GIT 쓸 일이 없다 보니..

일단 리눅스에서 개발하면서 한번 써보면 파악이 되겠지 머..


$ apt-cache search git | grep ^git

git - fast, scalable, distributed revision control system

git-core - fast, scalable, distributed revision control system (obsolete) 

git-all - fast, scalable, distributed revision control system (all subpackages)


step 1. 패키지 설치(안되어 있다면)

$ sudo apt-get install git 


step 2. git 설정

$ git config --global user.name "이름"

$ git config --global user.email "이메일주소"

$ git config --global color.ui "auto" 


step 3. 설정 내용 확인

$ git config --list

user.name=이름

user.email=이메일주소

color.ui=auto

$ vi ~/.gitconfig

[user]

        name = 이름

        email = 이메일주소

[color]

        ui = auto 


step 4. 저장소 생성

$ mkdir git_repo

$ cd git_repo

~/src/git_repo$ git init
초기화: 빈 깃 저장소, 위치 /home/odroid/src/git_repo/.git/ 
$ ll
합계 12
drwxrwxr-x 3 odroid odroid 4096  4월 24 15:56 ./
drwxrwxr-x 5 odroid odroid 4096  4월 24 16:08 ../
drwxrwxr-x 7 odroid odroid 4096  4월 24 15:56 .git/
$ du -h
8.0K    ./.git/info
44K     ./.git/hooks
4.0K    ./.git/objects/info
4.0K    ./.git/objects/pack
12K     ./.git/objects
4.0K    ./.git/branches
4.0K    ./.git/refs/heads
4.0K    ./.git/refs/tags
12K     ./.git/refs
96K     ./.git
100K    .


step 5. 저장소 복제
$ mkdir test
$ cd test
$ git clone ~/src/git_repo/
'git_repo'에 복제합니다...
warning: 빈 저장소를 복제한 것처럼 보입니다.
완료. 


[링크 : http://devaom.com/?p=745]

[링크 : https://git-scm.com/book/ko/v2/Git-서버-프로토콜]



+

bare를 주면 .git 아래 생성될게 바로 생성되는건가?

$ git init --bare --shared

초기화: 빈 공유 깃 저장소, 위치 /home/odroid/src/tt/


$ ll

합계 40

drwxrwsr-x 7 odroid odroid 4096  4월 24 16:08 ./

drwxrwxr-x 5 odroid odroid 4096  4월 24 16:08 ../

-rw-rw-r-- 1 odroid odroid   23  4월 24 16:08 HEAD

drwxrwsr-x 2 odroid odroid 4096  4월 24 16:08 branches/

-rw-rw-r-- 1 odroid odroid  126  4월 24 16:08 config

-rw-rw-r-- 1 odroid odroid   73  4월 24 16:08 description

drwxrwsr-x 2 odroid odroid 4096  4월 24 16:08 hooks/

drwxrwsr-x 2 odroid odroid 4096  4월 24 16:08 info/

drwxrwsr-x 4 odroid odroid 4096  4월 24 16:08 objects/

drwxrwsr-x 4 odroid odroid 4096  4월 24 16:08 refs/


$ du -h

8.0K    ./info

44K     ./hooks

4.0K    ./objects/info

4.0K    ./objects/pack

12K     ./objects

4.0K    ./branches

4.0K    ./refs/heads

4.0K    ./refs/tags

12K     ./refs

96K     .


[링크 : https://git-scm.com/book/ko/v2/Git-서버-서버에-Git-설치하기]


+

shared가 정의되지 않으면 umask에 의해 나오는 결과로 생성하는 것으로 보인다.

근데.. shared만 설정하면 머가 되는진 모르겠네?

 

--shared[=(false|true|umask|group|all|world|everybody|0xxx)]

Specify that the Git repository is to be shared amongst several users. This allows users belonging to the same group to push into that repository. When specified, the config variable "core.sharedRepository" is set so that files and directories under $GIT_DIR are created with the requested permissions. When not specified, Git will use permissions reported by umask(2).

The option can have the following values, defaulting to group if no value is given:

umask (or false)

Use permissions reported by umask(2). The default, when --shared is not specified.

group (or true)

Make the repository group-writable, (and g+sx, since the git group may be not the primary group of all users). This is used to loosen the permissions of an otherwise safe umask(2) value. Note that the umask still applies to the other permission bits (e.g. if umask is 0022, using group will not remove read privileges from other (non-group) users). See 0xxx for how to exactly specify the repository permissions.

all (or world or everybody)

Same as group, but make the repository readable by all users.

0xxx

0xxx is an octal number and each file will have mode 0xxx0xxx will override users' umask(2) value (and not only loosen permissions as group and all does). 0640 will create a repository which is group-readable, but not group-writable or accessible to others. 0660 will create a repo that is readable and writable to the current user and group, but inaccessible to others.

By default, the configuration flag receive.denyNonFastForwards is enabled in shared repositories, so that you cannot force a non fast-forwarding push into it.

If you provide a directory, the command is run inside it. If this directory does not exist, it will be created.


[링크 : https://git-scm.com/docs/git-init#git-init---sharedfalsetrueumaskgroupallworldeverybody0xxx]


위에 기록을 보니..

SGID를 통해서 접근 통제를 하도록(그룹권한을 따름) rws로 설정된다.



+

git 혼자사용으로 검색

[링크 : http://www.internetmap.kr/entry/Simple-Guide-for-Git]


+

2018.04.26

git 콘솔 명령어 목록 모음

[링크 : https://github.com/jeonghwan-kim/git-usage]

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

git mv 와 log  (0) 2018.08.14
git mv  (0) 2018.08.13
svn 로그 수정 pre-revprop-change  (0) 2017.12.20
svn externals commit 제외하기  (0) 2017.12.10
svn externals 제약사항 (파일은 안됨)  (0) 2017.11.03
Posted by 구차니

svn 에서 로그를 수정하는 방법인데.

이걸 허용하면, 로그가 수정되는것에 대한 로그는 안남으니

로그에 대한 신뢰성이 떨어질수도 있게 되니 주의해서 써야 할 듯..


아무튼 그냥 사용하려고 해보니까

show log에서 edit log message

창이뜨는데 수정대충하거나 그냥 OK 눌러보면

요런 에러가 뜬다.


원인이야.. 기존에 사용하던 저장소가 기본설정이라

해당 파일이 없기 때문이고

해당 저장소의 hooks 아래로 들어가서 단순하게 아래 한줄 실행하면 해결되긴 하는데..

수정이 가능하다는건 로그에 대한 신뢰가 떨어진다는 문제니까 고민이 되네..

허용을 해야 하나 말아야 하나....

$ sudo cp pre-revprop-change.tmpl pre-revprop-change


hooks$ cat pre-revprop-change.tmpl

#!/bin/sh


# PRE-REVPROP-CHANGE HOOK

#

# The pre-revprop-change hook is invoked before a revision property

# is added, modified or deleted.  Subversion runs this hook by invoking

# a program (script, executable, binary, etc.) named 'pre-revprop-change'

# (for which this file is a template), with the following ordered

# arguments:

#

#   [1] REPOS-PATH   (the path to this repository)

#   [2] REVISION     (the revision being tweaked)

#   [3] USER         (the username of the person tweaking the property)

#   [4] PROPNAME     (the property being set on the revision)

#   [5] ACTION       (the property is being 'A'dded, 'M'odified, or 'D'eleted)

#

#   [STDIN] PROPVAL  ** the new property value is passed via STDIN.

#

# If the hook program exits with success, the propchange happens; but

# if it exits with failure (non-zero), the propchange doesn't happen.

# The hook program can use the 'svnlook' utility to examine the

# existing value of the revision property.

#

# WARNING: unlike other hooks, this hook MUST exist for revision

# properties to be changed.  If the hook does not exist, Subversion

# will behave as if the hook were present, but failed.  The reason

# for this is that revision properties are UNVERSIONED, meaning that

# a successful propchange is destructive;  the old value is gone

# forever.  We recommend the hook back up the old value somewhere.

#

# On a Unix system, the normal procedure is to have 'pre-revprop-change'

# invoke other programs to do the real work, though it may do the

# work itself too.

#

# Note that 'pre-revprop-change' must be executable by the user(s) who will

# invoke it (typically the user httpd runs as), and that user must

# have filesystem-level permission to access the repository.

#

# On a Windows system, you should name the hook program

# 'pre-revprop-change.bat' or 'pre-revprop-change.exe',

# but the basic idea is the same.

#

# The hook program typically does not inherit the environment of

# its parent process.  For example, a common problem is for the

# PATH environment variable to not be set to its usual value, so

# that subprograms fail to launch unless invoked via absolute path.

# If you're having unexpected problems with a hook program, the

# culprit may be unusual (or missing) environment variables.

#

# Here is an example hook script, for a Unix /bin/sh interpreter.

# For more examples and pre-written hooks, see those in

# /usr/share/subversion/hook-scripts, and in the repository at

# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and

# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/



REPOS="$1"

REV="$2"

USER="$3"

PROPNAME="$4"

ACTION="$5"


if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi


echo "Changing revision properties other than svn:log is prohibited" >&2

exit 1 


[링크 : http://junho85.pe.kr/48]

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

git mv  (0) 2018.08.13
우분투에서 GIT 사용방법  (2) 2018.04.24
svn externals commit 제외하기  (0) 2017.12.10
svn externals 제약사항 (파일은 안됨)  (0) 2017.11.03
tortoiseSVN 엑셀 비교  (0) 2017.09.16
Posted by 구차니