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

github - Git working fork with updates

I wonder if the following scenario is possible with Git.

I forked someone's repository.

I do want to work on my own copy of the repository with getting updates from the initial repository.

Occasionally, I do want to release my code and send pull request to initial repository.

I am not sure if this possible, if yes please describe shortly what should I do.

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

It is possible, but a couple of best-practices would involve:

  • doing your modification in your own branch (that you can push to your fork)
  • updating the branches common with the original repo with a git fetch upstream (upstream being the name of a remote referencing the original repo you forked)
  • rebasing your own branch on top of the updated original branch:
    (See "git fork is git clone?")

    git checkout myBranch
    git rebase upstream/master
    
  • if you do a PR, try to make it a small one (with a few commits in it), focus on a specific feature, rather than doing a large one, with many commits and many changes in it.

See more at "couples tips on pull requests".


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

...