Я новичок в ветвлении в git, и меня немного смущает поведение на переключающихся ветках.Выполните следующие действия:
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
Почему изменения в файле .txt автоматически загружаются в мастер при оформлении заказа?Разве это не цель «слияния»?Я думал, что работа над веткой, а затем переключение на другую будет изолирована ...