나는 git을 처음 접했고 git checkout을 실행하여 분기간에 전환 할 때 git이 다른 분기의 한 분기에서 변경 한 내용을 계속 표시하는 이유를 이해하려고 노력했습니다. 먼저 git add를 사용하지 않았는데 작동하지 않았습니다. 그러나 나는 git add를 사용해 보았지만 문제를 해결하지 못했습니다. 아직 git commit을 사용하고 있지 않습니다.
이것은 기본적으로 내가하는 일입니다.
$ git clone <a_repository>
$ git branch
* master
$ git branch testing
$ git checkout testing
...edit a file, add a new one, delete...
$ git status
# On branch testing
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: file1.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# file2.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git branch
master
* testing
$ git checkout master
D file1.txt
Switched to branch 'master'
$ git status
# On branch master
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: file1.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# file2.txt
no changes added to commit (use "git add" and/or "git commit -a")
브랜치를 사용하는 동안 한 브랜치에서 무엇을하든 다른 브랜치에서는 보이지 않는다고 생각했습니다. 그것이 지점을 만드는 이유가 아닙니까?
"git add"를 사용해 보았지만 변경 사항은 두 가지 모두에서 볼 수 있습니다. 이것을 피하기 위해 분기간에 전환하기 전에 "git commit"을 실행해야합니까?