F
F
Fengol2019-10-21 18:20:13
git
Fengol, 2019-10-21 18:20:13

Is this normal behavior for git?

From master change dev branch-
> git checkout dev
Then create a new branch
> git checkout -b new-dev
Modify the README.md file and execute
> git add .
> git commit -m "initial commit"
Then I create a mocks folder and some files in it (a.php, b.php) and then
> git add .
> git commit -m "add mocks"
Then I go back to the dev branch
> git checkout dev
And here's the most important thing - I see the mocks folder with files.
Is this how it should be? At what > ​​git status and > git log do not show anything strange.
This happens when creating any branches. Everything is mixed. Moreover, if new files were ignored in the new branch, then they fall into the branch from which it was created.
At least some guesses, assumptions and ways to eliminate this abnormal behavior!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2019-10-21
@Fengol

I can't link this

Затем создаю папку mocks и несколько файлов в ней (a.php, b.php) и затем
> git add .
> git commit -m "add mocks"

And here it is
So are they on ignore or did you commit them?
If a folder is ignored, then it will appear in any branch, that's why it is ignored, so that git does not track files that are ignored, just synchronize gitignor between branches, or if the folder is not specific to the project, put it in the global git ignore
And if you added a folder to a commit and committed it (you can see it in the commit changelog), then it should be gone as soon as you switch to the original branch

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question