C. Norwood
C. Norwood

Reputation: 109

Making changes to git pull request locally, after numerous merge conflicts resolved in Github GUI

I've got a pull request I've been trying to get merged. The first time I submitted it, there ended up being a merge conflict first, and in the process of trying to fix it locally, I ended up "dirtying" up the PR with dozens of other people's commits ending up in there, rather than the 1 or 2 cleanly rebased & squashed commits that were originally there.

I closed the PR, I dug through the diffs and recreated the branch & PR based off the newer upstream master, and it's been sitting for about a week. In the meanwhile, there were two merge conflicts I resolved ON GITHUB, such that in the commit history, its clean and shows just my initial squashed commit, and the two force-pushed resolved conflicts.

The maintainer has asked me to make a couple easy changes before merging, but I want to avoid the mess I made the first time. At his suggestion, I deleted my LOCAL branch, and pulled it from my fork again, but it's showing up one commit short for some reason, without the newest merge conflict resolved.

I'm so confused truth be told, and I just can't figure out how I'm supposed to do this. Can anyone help me out?

Here is the PR: https://github.com/WikiEducationFoundation/WikiEduDashboard/pull/3481/

Here is my local fork, selected to the appropriate feature branch where I did all the work: https://github.com/chrisnorwood/WikiEduDashboard/tree/feature/convert-alerts-list-to-react-2

I deleted my local branch and repulled it with the following command: git co -b feature/convert-alerts-list-to-react-2 origin/feature/convert-alerts-list-to-react-2

When I run git log on the newly pulled branch, it shows 51cc7be50... as the latest commit (Nov. 15th), but not a029135e42... (Nov 21) as shown on Github.com .... is that weird?

How can I get the correct version of the branch, with all relevant commits locally, so when I push to my fork again, the PR is updated without showing like 50+ other people's commits in there????

Upvotes: 1

Views: 725

Answers (1)

VonC
VonC

Reputation: 1326776

The maintainer has asked me to make a couple easy changes before merging

Then no need to delete everything: make your changes on your local PR branch and push: it will update the PR automatically, and notify the maintainer.

But if you already deleted/recloned, to be sure to get the original repo ID:

git remote add upstream https://github.com/WikiEducationFoundation/WikiEduDashboard
git fetch upstream 
git fetch upstream pull/3481/head:feature/convert-alerts-list-to-react-2 
git switch feature/convert-alerts-list-to-react-2
... # work, commits
git push -u origin feature/convert-alerts-list-to-react-2

Upvotes: 1

Related Questions