Я справді новачок у git, і я намагаюся зрозуміти, чому git продовжує показувати все, що я змінив в одній гілці в іншій гілці, коли запускаю git checkout, щоб перемикатися між гілками. Спочатку я спробував не використовувати додавання git і не працював. Однак я спробував тоді використовувати 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" перед перемиканням між гілками, щоб цього уникнути?