How to do multiple times of pull request properly?

Sometimes I saw a few wrong / need-to-improved places in Docs. I would like to do some contribution but I got some, let say, bad concept about pull request. When I try to do pull request the second time with the previous one haven’t got approved yet will cause the previous code mixed in the current code. Is there anyway to avoid it?

For example:

  1. pull request: first time
    • a.file → change line 9-20
    • b.file → change line 1-3
  2. pull request: second time
    • (expected)
      • a.file → change line 6-13
      • c.file → change line 5-7
    • (reality ← I want to avoid this)
      • a.file → change line 6-20
      • b.file → change line 1-3
      • c.file → change line 5-7

I’m aware this is off-topic. But let’s see it as a instruction for who want to contribute to Hugo repo but have not really good at git stuff. It’s ok right?

I moved it to the dev forum and suddenly it’s on-topic :slight_smile:

Specific to pull requests in the documentation (and just my own opinion):

  • if you correct typo’s then make one pull request with all your corrections. If you want make one pull request per file that you edit (you can do so by directly editing on GitHub)
  • if you correct content, then keep the topic of change to one per pull request to keep it clean.

Now about the amount of pull requests if you change for instance two sections in one file: You can create a branch against the master branch where you edit only section 1 and a second branch where you edit section 2. The pull requests then will work without influencing each other.

If you send a new commit against a branch where you already opened a pull request then this commit will be added to the current pull request as an additional commit.

So, for short: One topic per branch, one pull request per branch. When the pull request was merged then delete the branch.

On Github itself (and in the documentation) you find ways to edit directly on the website. It will create a separate branch to whatever you were editing before. That’s probably the easiest way.


Your answer has totally enlightened me. Thank you very much.