How do you create the 'master' branch on git if you forgot to create it before branching? -
someone created repo locally, branched off, , pushed branch remote. possible person create 'master' branch without commits, , force remote?
no. cannot have branch no commits, , no master
branch ever has no commits. master
not exist in git repository until first commit.
when create new git repository, .git/refs/head
contain following:
ref: refs/heads/master
however, refs/heads/master
not yet exist, , won't until commit. there is no master
branch until first commit, , there nil push.
you can utilize git log
find earliest commit, , create master
pointing commit, happen new repository.
for more information: fatal: not valid object name: 'master'
git branch
No comments:
Post a Comment