I have made my first commit; then created a branch (let\'s say branch1).
In this branch I\'ve created a directory \'example\' and commited. In GitHub I see my new branch
According to the Git Cheatsheet you have to create the branch first
git branch [branchName]
and then
git checkout [branchName]
Will take you to the master branch.
git checkout master
To switch to other branches do (ignore the square brackets, it's just for emphasis purposes)
git checkout [the name of the branch you want to switch to]
To create a new branch use the -b like this (ignore the square brackets, it's just for emphasis purposes)
git checkout -b [the name of the branch you want to create]
For deleting the branch you have to stash the changes made on the branch or you need to commit the changes you made on the branch. Follow the below steps if you made any changes in the current branch.
git stash
or git commit -m "XXX"
git checkout master
git branch -D merchantApi
Note: Above steps will delete the branch locally.
You need to checkout the branch:
git checkout master
See the Git cheat sheets for more information.
Edit: Please note that git does not manage empty directories, so you'll have to manage them yourself. If your directory is empty, just remove it directly.
I'm trying to sort of get my head around what's going on over there. Is there anything IN your "example" folder? Git doesn't track empty folders.
If you branched and switched to your new branch then made a new folder and left it empty, and then did "git commit -a", you wouldn't get that new folder in the commit.
Which means it's untracked, which means checking out a different branch wouldn't remove it.