How to contribute to someone else's repository?

前端 未结 5 1505
小蘑菇
小蘑菇 2021-01-18 22:48

I have a friend who has a repository in his GitHub account. I want to contribute (pull/push) to the master branch (the only branch) on that repo directly.

How would

5条回答
  •  醉梦人生
    2021-01-18 23:29

    I'm summing up everyone's answer.

    1. Fork your friend's repository.
    2. Fire up your terminal and type git clone {URL}.
    3. Use this command to create a branch: git checkout -b new_branch.
    4. Create a new remote for the upstream repo i.e. the link of original repo with the command: git remote add upstream {URL}
    5. Do whatever changes you want in your local machine.
    6. Fire up your terminal again and type git add {file name} or git add . if you want to add all files.
    7. Then type a message git commit -m "message"
    8. Create a branch: git remote add upstream {URL of friend's repository that you have forked}
    9. For confirmation: git remote -v
    10. git push Here you have to give your username and password.

提交回复
热议问题