When you commit the GIT "store" the state of your workspace, what I imagine you did was create a branch, add multiple files, work on what you needed, and commit right?
When you returned to the master branch git checkout master
git reverts everything to the state of the branch you are entering, in the master case, that did not have the files that were added in the other branch.
I suggest you read the git documentation Branching in Git - Branch and Merge Basics
To have in the master branch what was done in the other branch you need to merge the two branches, with git merge
, would be something like git merge meubranch
.
When you use the merge, superficially speaking, git analyzes what has been changed, including files, removed, and "merges" with your branch, so that the two are in the same state.
One of the purposes of git is just that, you can navigate between the various states / commits, just to create a kind of life history of the files.
I do not know if I can be clear enough.