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
472 views
in Technique[技术] by (71.8m points)

jira - git branch rebase common convention

I am working on a project having a master branch with some base code.
Then I made a branch develop1 and committed and push to remote and requested for pull request.

Okay, then I want to do another task but in-fact the pull request is not yet completed, is not yet merged with master.

So in this situation if I create a branch develop2 and rebase it with develop1 and write some codes and pushed it to remote what will happen is everything will be okay with out conflict and could I request for pull request for develop2 is it possible?
Or is this the common convention while working with pull request?

question from:https://stackoverflow.com/questions/66058292/git-branch-rebase-common-convention

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

1 Reply

0 votes
by (71.8m points)

If:

  • develop2 does not depend on develop1
  • must be merged to master

You should:

  • fetch
  • create develop2 from origin/master
  • work, push develop2 and request a separate pull-request

If develop2 depends on develop1, create it from develop1, and once develop1 is accepted (merged to master):

  • fetch

  • rebase develop2 to master

      git rebase --onto origin/master develop1 develop2
    

That will rebase all commits done after your develop1 local branch, up to your develop2 HEAD.

  • push develop2, make a pull-request.

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

...