How to handle view pull request, change code and merge?

Let's say I have a repository myproject

on GitHub.

A user named has userblah

suggested a pull-request .

I tried the following to check the modifications:

git checkout -b userblah-test    
git pull https://github.com/userblah/myproject.git  

      

Then I had access to the version of it in my folder, that's ok.

Then I decided to change a few things in my code: I opened the code in a text editor, made some changes, and saved.

Then I wanted to switch to branch master

, but I was wrong in saying that I could not switch to master because userblah-test

incorrect modifications were made to the current branch userblah-test

.

What are the correct commands to handle a pull request?

I mean:

  • Pull the user code into a new branch
  • Modify your code a bit to suit my tastes.
  • Click this in mine master

    so the username userblah

    will be registered as a member of the file
+3


source to share


2 answers


I think you probably want to do a merge that will take changes from one branch and "merge" (merge) them with the changes on another.

Assuming you want to change the suggested code:

  • git checkout -b userblah-test

    (checks out a new branch named userblah-test)
  • git pull https://github.com/userblah/myproject.git

    (pull suggested changes from userblah)
  • Make changes
  • git add .

    (adds all modified files)
  • git commit

    (commits changes - it's important to note that you only commit your changes to the current branch, i.e. userblah-test

    )
  • git checkout master

    (checks out master branch before merging)
  • git merge userblah-test

    (merges all changes made to userblah-test

    the current branch)


However , if the pull request was submitted via GitHub, I suggest that you inform the original author of the changes you would like to make to the pull request comments. The author must be prepared to make these changes himself and add them to the pull request. You can then bundle your PR using GitHub's own web interface - see here for more information.

Pull requests are meant to facilitate discussion of code, if you are not 100% happy with the changes this person suggested - let them know!

+3


source


Minor modification to @ rmorrin's answer, this is how I tried to handle the Pull request from userblah

:

  • git checkout -b userblah-test master

    (added master

    here and next line)
  • git pull https://github.com/userblah/myproject.git master

  • Make changes
  • git add .

  • git commit -m "test"

  • git checkout master

  • git merge userblah-test

  • git push



The only problem is it then userblah

doesn't show up in the Github contributor list, it userblah

didn't seem to have done anything ...

0


source







All Articles