2011-01-27 10 views
28

"변경되었지만 업데이트되지 않은 평균"은 무엇입니까? 이 파일들은 git에 있고 수정되었지만 "git status"를 실행하면 "Changes to commit"대신 "Changed but updated"아래에 나타납니다.힘내 : 파일 "변경되었지만 업데이트되지 않았습니다"

# On branch master 
# Changes to be committed: 
# (use "git reset HEAD <file>..." to unstage) 
# 
# modified: breakouts/views.py 
# 
# Changed but not updated: 
# (use "git add <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
# modified: templates/registration/login.html 
# modified: templates/registration/registration.html 

# Untracked files: 
# (use "git add <file>..." to include in what will be committed) 
# 
# context_processors.py 
# static/#css.css# 

그들은 이미 추가되었으므로 "변경 사항이 커밋되었습니다"가 아닌 이유는 무엇입니까?

+1

여기서 핵심 아이디어는'git add'로 커밋을 준비한다는 것입니다. 즉, 준비 영역 (인덱스)에 수정 사항을 넣은 다음 커밋 할 항목을 준비하고 나면 커밋합니다 . 이것은 주어진 커밋에 무엇이 들어가는지를 매우 조심하게합니다. – Cascabel

답변

5

파일을 수정할 때마다 파일을 처음에 추가 했더라도 파일을 커밋 할 수 있으려면 git add을 사용하여 파일을 추가해야합니다.

3

git add <file>은 변경 사항이 추가되지 않으면 커밋되지 않은 로컬 커밋 일정에 '변경 사항'을 추가합니다.

왜? 이것은 통역에 열려있는 용어가있는 것처럼 git의 워크 플로우입니다. 아마도 당신은 add이라는 SVN의 아이디어에 익숙해 졌을 것입니다. 가정하는 것을 포기하고 어떻게 git이 일을하는지 배우십시오.

23

당신은 git add마다 또는 사용 git commit -a 또는 대신 일반 git commitgit commit --all을 사용해야합니다. Git docs에서

:

 
-a 
--all 
    Tell the command to automatically stage files that have been modified 
    and deleted, but new files you have not told git about are not affected. 

add은 기본적으로 "이 파일/디렉토리의 통지를 받아"명령입니다. CVS 나 Subversion에서이 파일을 추적하는 것이 아닙니다.

+2

최신 버전의 자식 버전 (> 1.8)에서는 "변경되었지만 업데이트되지 않은"주석이 "커밋을 위해 준비되지 않은 변경 사항"으로 변경되었습니다. –

관련 문제