Monday 14 February 2022

Create a Pull Request in GitHub


Create a Fork

Login to GitHub and from the same browser navigate to the following repository(owner) 

https://github.com/SharedRepo

In the top-right corner of the page, click the Fork button to enable Fork


Clone your Fork in terminal

mkdir Git-PR

cd Git-PR

On GitHub, click on the code button on your repository

Copy the URL from under Clone with HTTPS option

git clone [the copied HTTPS URL]

#clone command creates a local git repository from your remote fork on GitHub.


Sync fork with the original repository

cd SharedRepo

git remote -v


|git config --global --list

|#add user details if required

|git config --global user.name "Your Name"

|git config --global user.email "yourgitemailid@gmail.com


#commit

echo "my first files" > foo.txt

git status

git add foo.txt

git commit -m "first file"


|#see log

|git log #q to quit

|git log --oneline


Push changes

git remote -v

git push -u origin main 

#Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.

GithubSettingsDeveloper SettingsPersonal access tokensGenerate new token

give userid and personal access token using keys shift+insert(*Enter)

#verify the commit in your GitHub account repository


Create a Pull Request

Your GitHub forked repositoryPull requestsNew pull requestCreate pull request

#Choose two branches to see what’s changed or to start a new pull request.

#check "base repository" and "head repository (your GitHub) is correct.

#share this URL or owner can see in their GitHub Pull requests tab.

#now the owner can see the pull request and from where it comes

The owner can select the Pull requestMerge pull requestconfirm mergecomment(close with).


No comments:

Post a Comment