Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
788 views
in Technique[技术] by (71.8m points)

github - Change from master to a new default branch git

Here is a scenerio:

We have a default branch Master and we work off from this, creating branches and pushing up etc...

We have now created a Develop branch off Master and set this as a default development branch.

What I would like to know is, how do I now know if my git pull command is requesting changes from the default branch via the command line? or point to this new default branch?

What I have done: - Since creating a new default branch git pull into my master from origin/master

Also, any neww branch, will it be from Master or Develop?

As you can see

On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
PS C:UsersdirDocumentsGitHub
epo> git log
commit 867cxx

fd956f73dc91d0022b (HEAD -> master, origin/master, origin/develop, origin/HEAD)

update: this change of default branch occurred after cloning the repo.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

With git 2.28 you can set a global config with this command git config --global init.defaultBranch {branchName}

Replace {branchName} with the default branch name and now whenever you create a new git repo, the default branch will be this.

More details in my video here: https://www.youtube.com/watch?v=YccHk6QlRss


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...