I have just created a branch from master
called new_branch
So I have checkout that new branch, add a new file, and then add/commit/push.
git add new_file.php
git commit -m "A new file"
git push origin new_branch
So after that, I have cloned my repo example, and the thing is that that file I have added in the new branch is not in the master branch of cloned work-tree. What should I do to find it that new file in the master branch of the cloned work-tree?
NOTE: sorry because of the imprecision of the title. Maybe someone wants to change it.
Your question indicates that you did not fully understand what a branch is and what the master branch is. I would recommend reading more and doing tutorials.
To answer the question with a very basic workflow, that you could use: I assume that "new_branch" is a feature branch and your workflow is to merge features branches into a single master branch (a classic, simple git workflow). switch to master branch:
git checkouter master
merge your feature:
git merge new_branch
(fix merge conflicts, since you just add a file, there should not be any) publish the changes:
git push origin
Now you have merged your new feature into the master branch and every clone will contain your feature. As mentioned by @chepner git offers much more possibilities, however, for learning and understanding branches this is a simple starting point.