I want to create a new branch and upload a completely different code base while keeping the original codebase intact on the master branch. However when I attempted this I wound up with a second branch with the master branches code. How do I create an empty branch to upload my new codebase to?
From the git man pages, you can create a totally new line of history starting with the current version of all files by running:
git checkout --orphan branch-name
If you additionally do not want any of the files, you would then run:
git rm -rf .
Which would completely empty the current files. Be sure you are running git rm and not simply rm as you'll wipe out the .git directory and all your local history too!
git rm -rf .
Will remove everything from the working branch. As long as you have switched branches first, this is safe. Don't foget testing is as easy as making a copy/clone of the entire repo and trying it! Untracking everything and pushing probably isn't what you were looking to do unless you already committed all your files into the branch.
Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs