2016-06-15 3 views
0

코코아포드를 업데이트하면 프로젝트의 일부 파일이 변경되었습니다. 변경 사항을 유지하기 위해 bitbucket을 사용했습니다. 이제 이전 커밋 (id 포함)을 다른 디렉토리에 다운로드하고 필요한 파일을 복사/붙여 넣기 만하면됩니다. 그리고 다운로드가 git (파일 복사/붙여 넣기 전까지)에 영향을 미치기를 원하지 않습니다. 먼저 다른 폴더에 프로젝트 git clone을 보냅니다.별도의 디렉토리에서 이전 커밋으로 재설정

지금, 나는 정말 주요 차이점이 무엇인지 가져올 수 없습니다

git reset --hard & git reset --soft

에 걸쳐왔다. 어느 것을 사용해야합니까? man git에서

답변

0

는 :

git reset [<mode>] [<commit>] 
     This form resets the current branch head to <commit> and possibly updates the index (resetting it to the tree of <commit>) and the working tree depending on <mode>. If <mode> is omitted, defaults to 
     "--mixed". The <mode> must be one of the following: 

     --soft 
      Does not touch the index file or the working tree at all (but resets the head to <commit>, just like all modes do). This leaves all your changed files "Changes to be committed", as git status would 
      put it. 

     --mixed 
      Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action. 

      If -N is specified, removed paths are marked as intent-to-add (see git-add(1)). 

     --hard 
      Resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded. 

     --merge 
      Resets the index and updates the files in the working tree that are different between <commit> and HEAD, but keeps those which are different between the index and working tree (i.e. which have 
      changes which have not been added). If a file that is different between <commit> and the index has unstaged changes, reset is aborted. 

      In other words, --merge does something like a git read-tree -u -m <commit>, but carries forward unmerged index entries. 

     --keep 
      Resets index entries and updates files in the working tree that are different between <commit> and HEAD. If a file that is different between <commit> and HEAD has local changes, reset is aborted. 

따라서 차이가 --hard이 망할 놈의 통제하에있는 파일을 로컬 변경 사항을 버릴 것입니다. 반면에 --soft는 기호 참조 HEAD가 이전 커밋 ID를 가리 키도록 만 만듭니다.

+0

그래서 전 커밋의 사본을 다른 디렉토리에 넣고 싶다면 git에 영향을주지 않고 하드 또는 소프트를 사용해야합니까? – senty

+0

글쎄, 그것은 "영향을 미치지 않고 ... 자식"이라는 의미와 정확히 "커밋 사본"으로 무엇을 의미하는지에 달려 있습니다. 내가 너를 올바르게 이해한다면, 나는 "복사하고 다른 디렉토리"라는 이야기 때문에 - 하드 재설정을 원한다고 생각할 것이다. 그러나 다른 git 명령을 사용하여 목표에 쉽게 도달 할 수 있다고 확신하지만 질문을보다 명확하게 다시 작성해야합니다. – Mischa

관련 문제