noob to git:
expanding on this question a little
I created a repository and committed my README.md to the master branch.
My local folder structure is:
projectName
--README.md
-- + part1
-- -- README.md
-- -- + src
-- + part2
-- + ...
I initialized git init in the projectName folder and was able to make the commit.
Then I do git checkout -b part1.
cd .\part1 and git add .\README.md .\src
When I commit and push git push -u origin part1 and check my repository my master branch has all the files from part1 and the part1 branch has correct files but it contains the README.md from the master branch.
After I ‘remove’ the master README.md I want to commit from branch part1 the files/folders in my local part1 folder. The problem I am having with this is when I commit the actual folder part1 shows up in the part1 branch. I just want the contents to show up.
EDIT_1
I want to create multiple branches. After committing to the master branch I do this:
git checkout -b part1
When I commit from part1 I don’t want the README.md from the master coming along for the ride. Doing git rm README.md deletes the file from my local directory.
UPDATE
I was confused about the second part of my own question. @willoller clarified.
Use the following command
git checkout -b new_branchto create a new branch from current branch.So you created your
part1frommasterand your README.md was copied frommaster.“-u” creates a relation with remote branch.
If you want push your branch to remote host, you could just use
git push origin my_branch.To delete files from branch use
git rmand commit the changes afterwards.I hope I’ve helped.