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
617 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 Answer

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".


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

...