RodFalanga avatar image
0 Votes"
RodFalanga asked RodFalanga commented

Why couldn't I create a PR from Git Changes?

I have two GitHub accounts; one I'll call my Work account and the other I'll call Personal. On Friday I created a new GitHub repo using my Work account. I pushed everything to origin, then I added as a contributor in GitHub, my Personal account. Today I cloned the repo onto my home machine using my Personal account. I created a branch from the Personal account, did some work, then when I thought it was finished and pushed changes to the feature branch, I tried to create a PR back to main from the Git Changes in VS 2022. However, it didn't work. I clicked the link in VS 2022 to create the PR, but nothing happened. So, I got into the Work account, created the PR there. Merged, deleted the feature branch, etc. I went back into the Personal account, went to the main branch, pulled changes, and blew away the feature branch.

But why couldn't I have done that from the Personal account in VS 2022? Do I have to fork the repo from the personal account, the cloned that to my home machine, do all my work in the forked clone, pushed to GitHub, and THEN create a PR to merge my changes back into main, from the Work GitHub account?

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I clicked the link in VS 2022 to create the PR, but nothing happened.

FWIW, the same has happened to me many times using VS Git (from 2019 onward) using an Azure Git repository. It mostly works fine, but occasionally clicking the link does nothing. I've no idea why, and don't have a way of reproducing it. If I use the Azure web interface, the pushed changes had worked, and I could create a PR using the web UI OK.

1 Vote 1 ·
RodFalanga avatar image RodFalanga DavidLowndes-6766 ·

Hmmm. Thinking about it I realize that this is the first time (I think) that I tried to create a PR from Visual Studio on a GitHub repo. All the other times I've done it with a repo hosted in Azure DevOps Services, where it seemed to work better. That makes me wonder if, when working with GitHub, I should just ignore the Create PR button in VS, then just go to the repo in GitHub to create the PR there?

I'm going to experiment to find out.

0 Votes 0 ·

I've tested making a change to a different branch, pushing that to the GitHub repo and creating a PR there. That works fine. So, from now on, whenever I believe I can create a PR in a GitHub repo, I'll not use the button in Visual Studio, I'll just use the web interface.

0 Votes 0 ·

Thinking it is a permissions issue with your personal account on the github repo. Did your branch with the changes make it to GitHub when you pushed your changes from visual studio 2022

0 Votes 0 ·

Hi @vb2ae, thank you for answering.

Yes, when I created the feature branch and pushed it to remote, it did show up in what I'm calling the Work GitHub's repo. I pushed about three changes to that branch, before I was satisfied with what I had done, so I then wanted to create a PR to merge the feature branch back to main.

Great questions! Thank you for asking it and helping me to clarify the situation I am facing.

0 Votes 0 ·

0 Answers