Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing to someone else's branch on Github

Tags:

github

I'm fairly new to GitHub, so I hope you can help out. There's a branch on a repo that I want to push changes to, but I'm not added as a collaborator on it. What steps do I need to take to push changes to that branch?

I have done some research and found that I may need to fork the repo, make changes locally then create a pull request, but I'm still a bit confused about it. I would appreciate any help.

like image 595
dalold Avatar asked Oct 29 '22 12:10

dalold


1 Answers

You can't simply push to the branch which you dont have the write access. You can simply fork the repo by clicking it fork button. Then clone the repo locally by using the command below

git clone https://github.com/your-username/project.git

Then you need to checkout to the branch which you need to make the change just use:

git checkout branch_name

Then make the necessary changes. Now you will have to commit the changes:

git add --all .
git commit -m "changes description"
git push

Now visit the repository in your profile. You can see a notification to open a new pull request.

Please see this for more info: https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/

like image 117
Gautam Krishna R Avatar answered Jan 02 '23 21:01

Gautam Krishna R