0

I can work as a "branch" without any "commit" in the "master" branch.

I'm in this branch.

branch master

And I want work in the branch "newStyle"

Question:

Is it possible (and if yes, how) to switch to that "newStyle" branch if I never committed in master first?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
A. M. Mérida
  • 2,458
  • 3
  • 18
  • 24
  • 4
    What is the question? – Useless Jun 24 '13 at 13:23
  • Sorry for the closed question. The moderators, while well-intentioned and generally awesome, preferred not to edit your question and just closed it. I tried to add a question: let me know if it fits your original intent. – VonC Jun 24 '13 at 13:40

1 Answers1

4

Yes, it is called an orphan branch:

git checkout --orphan newStyle     # only in git1.7.2+
git rm -rf .                       # if you want to start from scratch
<do work>
git add your files
git commit -m 'Initial commit'

See also an example in this article.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250