Re: How to handle pull request with git?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/15/21 1:24 PM, Mark Wielaard wrote:
On Wed, Apr 14, 2021 at 04:04:21PM +0200, Robert-André Mauchin wrote:
On 4/14/21 3:28 PM, Mark Wielaard wrote:
I got a "pull request" for one of my packages and wanted to make some
changes to discuss with the submitter and see if we could merge it
back with those changes to the rawhide branch. But somehow I did
something wrong and I am not sure what or how to fix it.

So I saw this webpage with the suggested change:
https://src.fedoraproject.org/rpms/valgrind/pull-request/4

I added the following line to my .git/config at the end of the [remote
"origin"] section to be able to pull it:

fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

Then git pulled and checkout pr/4, made the changes, committed them
and pushed them back, hoping that would update the pr.

But it didn't, apparently I created a new origin/pr/4 branch, which I
am now unable to delete because:

$ git push origin --delete pr/4
remote: Branch deletion is not allowed
remote: Denied push for ref 'refs/heads/pr/4' for user 'mjw'
remote: All changes have been rejected
To ssh://pkgs.fedoraproject.org/rpms/valgrind
   ! [remote rejected] pr/4 (pre-receive hook declined)
error: failed to push some refs to 'ssh://pkgs.fedoraproject.org/rpms/valgrind'

What did I do wrong and how do I fix this?


1. You clone the forked repository
2. You checkout the branch where the modification has been made
3. You edit the files you want to change
4. You commit (or amend) the new changes
5. You push (or force push) the commit
6. Your commit will appear in the Pull Request ar "Rebased blah blah"
7. Merge your changes

Thanks. So I believed I was doing the above, but apparently not.
Would you mind explaining steps 1, 2 and 5 a bit more.

So what I did to clone the prs was to add that extra fetch line in my
.git/config. Which seemed to allow me to pull and work on the branch
remote pull/4 as pr/4 locally. Then I though I pushed it back, but
apparently that created a new branch in the origin called pr/4 instead
of getting my changes back into the remote pull/4.

Apparently the fetch line doesn't work like I expected.

Thanks,

Mark

So you have this PR: https://src.fedoraproject.org/rpms/valgrind/pull-request/4

- You see it is coming from rpms/ahajkova/valgrind
So you go to https://src.fedoraproject.org/fork/ahajkova/rpms/valgrind/tree/rawhide (by clicking on the first "rawhide")

- and get the clone url and clone that repository:

git clone ssh://mjw@xxxxxxxxxxxxxxxxxxxxxx/forks/ahajkova/rpms/valgrind.git

- You checkout the branch where the changes have been made. Here it's already rawhide so you don't need to change.

 - Here you might need to rebase:

git remote add upstream ssh://mjw@xxxxxxxxxxxxxxxxxxxxxx/rpms/valgrind.git

git fetch upstream

git rebase upstream/rawhide

(Fix the eventual conflicts)

 - Then make the PR changes you want

 - Commit the changes by amending the previous commit

 - git push --force to force the edit of the commit to the remote

It will update your PR directly.
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux