We are using a git repository to store our project. We have our branches departing from the original branch. But now we want to create a small new project to track some docu
Let's say you have a master branch with files/directories:
> git branch
master
> ls -la # (files and dirs which you may keep in master)
.git
directory1
directory2
file_1
..
file_n
git checkout —orphan new_branch_namels -la |awk '{print $9}' |grep -v git |xargs -I _ rm -rf ./_git rm -rf .touch new_filegit add new_filegit commit -m 'added first file in the new branch'git push origin new_branch_nameIn step 2, we simply remove all the files locally to avoid confusion with the files on your new branch and those ones you keep in master branch.
Then, we unlink all those files in step 3. Finally, step 4 and after are working with our new empty branch.
Once you're done, you can easily switch between your branches:
git checkout master
git checkout new_branch