Answer the question
In order to leave comments, you need to log in
What is the correct way to create a clean branch in git?
I need to create a new clean branch, but since this is not possible in git, I choose the closest configuration. Next, I create a new branch using the command git checkout --orphan new-name
and after that I make a minor change in any file and execute add
and commit
. Next, I will delete the file from what I thought was a new branch, but it is deleted from the branch I created the current one with. Is it supposed to be like that? How to create a new clean branch so as not to repeat the above?
Answer the question
In order to leave comments, you need to log in
git checkout --orphan newbranch
git reset
git commit --allow-empty -m "init"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question