나는 git에서 분기하는 것을 처음 접했고 조금은 swithing 지점에서의 행동에 혼란 스럽다. 다음 단계를 따르십시오 :왜 지점을 전환 할 때 git merge가 자동으로 변경됩니까?
git init
Initialized empty Git repository in /Users/mads/Desktop/testing/.git/
echo 'hello a' > a.txt
echo 'hello b' > b.txt
git add *.txt
git commit -m "Initial commit"
[master (root-commit) 1ab870f] Initial commit
2 files changed, 2 insertions(+), 0 deletions(-)
create mode 100644 a.txt
create mode 100644 b.txt
git status
# On branch master
nothing to commit (working directory clean)
git branch new_feature
git checkout new_feature
Switched to branch 'new_feature'
ls
a.txt b.txt
echo "hello c" > c.txt
git add c.txt
echo "hello a, new version" > a.txt
git status
# On branch new_feature
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: c.txt
#
# 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: a.txt
#
git commit -m "Added new feature"
[new_feature 1ccda31] Added new feature
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 c.txt
git checkout master
M a.txt
Switched to branch 'master'
cat a.txt
hello a, new version
체크 아웃시 a.txt의 변경 사항이 자동으로 마스터로 가져 오게되는 이유는 무엇입니까? 이것이 '합병'의 목적이 아닌가? 나는 지점에서 일한 다음 다른 것으로 전환하는 것이 분리 될 것이라고 생각했습니다.