Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
809 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 Reply

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...