I'm new using git branches. What I want to do is a new feature keeping the original master in case I need to go back and do something else from there.
For this purpose I did the following:
git branch new feature
git checkout newfeature
From newfeature
branch, I made a fair amount of changes (I modified 78 files). Here is a summary of the git status:
On branch newfeature
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: //a long list of 60 files
Untracked files:
(use "git add <file>..." to include in what will be committed)
// a long list of 18 files
no changes added to commit (use "git add" and/or "git commit -a")
What I didn't expect is that when I go back to master
with the git checkout master
command, I see all the changes as if I were in the newfeature branch. Here is a summary of the git status of the master:
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: //a long list of 60 files
Untracked files:
(use "git add <file>..." to include in what will be committed)
// a long list of 18 files
no changes added to commit (use "git add" and/or "git commit -a")
How can I switch between the original master (which should not have the changes) and the newfeature (which contains the changes to all 78 files)?