-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfork_and_contributions_to_public_repository.txt
40 lines (36 loc) · 3.06 KB
/
fork_and_contributions_to_public_repository.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Question 1: How to sync forked repository with changes in the public repository ?
Assume Bogdan has made some changes in his repository. How will sangithubber get to sync the changes made by Bogdan
Ans : a)If you need to keep your forked repository up-to-date, clone the forked repository to your local computer.
b)Set up another remote server. By default, there is only 1 origin as default remote server.
c)Add the second remote server pointing to this parent repository and name it upstream.
Origin will be your own repository and upstream is your parent repository
With this you will be able to fetch and pull from the upstream repository.
After pulling changes, you will be able to push the changes to the forked repository(origin)
With this forked repository will be in sync with the parent repository
---------------------------------------------------------------------------------------------------------------------
git remote | origin
git remote add upstream https://github.com/bstashchuk/JavaScript-Bible-ES6.git
So, the result of git remote -v :
$ git remote -v
origin https://github.com/sandeepgithubber/JavaScript-Bible-ES6.git (fetch)
origin https://github.com/sandeepgithubber/JavaScript-Bible-ES6.git (push)
upstream https://github.com/bstashchuk/JavaScript-Bible-ES6.git (fetch)
upstream https://github.com/bstashchuk/JavaScript-Bible-ES6.git (push)
---------------------------------------------------------------------------------------------------------------------
git fetch upstream | Fetch the change from the upstream(Not from origin but from upstream)
---------------------------------------------------------------------------------------------------------------------
UPSTREAM | This is the name of another remote branch
---------------------------------------------------------------------------------------------------------------------
Question 2: How to open a pull request in the parent repository from the forked repository ?
Ans : a) Fork the "pull request" request from sandeepgithubber. Now kumarsandeepramanath will have a forked repo
b) Create a new branch Ex. feature-6 in the forked repository
c) Make all the changes in the feature-6 branch and do a "pull request"
d) Go to sandeepgithubber and then "Review changes" in "files changed" section and click "Approve"
e) Now sangithubber will be able to merge the changes from "kumarsandeepramanath :feature-6" to "sandeepgithubber:main"
---------------------------------------------------------------------------------------------------------------------
How to contribute to a public repository ?
Ans : a) Go to explore -> Look for the repo where you need to contribute
b) Go to issues tab -> click on any issues
c) if its something you can solve, fork the repository
d) Make a pull-request and ask for a merge to master of the parent repository.
---------------------------------------------------------------------------------------------------------------------