How to revert a pull request made with the wrong GitHub account, you can follow these steps:
1. Close the Pull Request:
Go to the GitHub repository where the pull request was made.
Navigate to the "Pull Requests" tab.
Find the pull request made with the wrong account.
Click on the pull request, then click on the "Close pull request" button.
2. Re-create the Pull Request:
Ensure you're using the correct GitHub account on your work computer.
Switch to the correct branch in your local repository.
Make any necessary changes or commits.
Push the branch to the remote repository.
Create a new pull request from the correct branch and account.
If the pull request has been merged or you want to change the author of the commits, you can amend the commit history:
- Set Up Git to Use the Correct User:
git config --global user.name "Your Correct Name"
git config --global user.email "[email protected]"
-
Rebase Interactive:
Start an interactive rebase:
git rebase -i HEAD~n
Replace n with the number of commits you want to change.
-
Change the Commit Author:
For each commit you want to change, replace pick with edit. with steps bellow.
a. Entering Insert Mode:
To start editing the file, you need to enter Insert mode. Press i to insert text at the cursor. You can also use a to start inserting text after the cursor or o to open a new line below the cursor.
b. Making Changes:
Type your text or make changes as needed. Use the arrow keys to move the cursor around.
c. Exiting Insert Mode:
Press Esc to return to Normal mode.
d. Saving Changes:
In Normal mode, type :w to save the file.
e. Saving and Exiting Vim:
In Normal mode, type :wq and press Enter to save and exit. Alternatively, you can type :x and press Enter to save and exit.
-
Amend the Commit:
For each commit marked for editing, change the author:
git commit --amend --author="Your Correct Name [email protected]"
Continue the rebase process:
```bash
git rebase --continue
-
Force Push the Changes:
Force push the changes to the remote repository:
git push --force
Create a New Pull Request:
If necessary, create a new pull request with the corrected commits.