Skip to content

Commit 089aaf9

Browse files
Create CONTRIBUTING.md (#35)
* Create CONTRIBUTING.md * Update CONTRIBUTING.md
1 parent 905436e commit 089aaf9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Diff for: CONTRIBUTING.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Sync Forked Repo from Upstream Repo
2+
3+
4+
1. Add the original repository as an upstream repository
5+
```javascript
6+
$ git remote add upstream https://github.com/[Original Owner Username]/[Original Repository].git
7+
```
8+
Hence, in this repository it would be
9+
```javascript
10+
$ git remote add upstream https://github.com/saadfareed/Leetcode.git
11+
```
12+
13+
2. Fetch all the changes from the repository. Note that commits to the original repository will be stored in a local branch called, upstream/master
14+
```javascript
15+
$ git fetch upstream
16+
```
17+
18+
3. Make sure that you are on your fork's master or working branch
19+
```javascript
20+
$ git checkout [working branch]
21+
```
22+
For example,
23+
```javascript
24+
$ git checkout master
25+
```
26+
27+
4. Merge the changes from the upstream/master into your local master or working branch. This will sync the fork's master branch with the upstream repository without losing your local changes. If you have made any changes that create conflict, you will have to resolve the conflict before you can complete the merge
28+
```javascript
29+
$ git merge upstream/master
30+
```
31+
32+
5. At this point, your local branch is synced with the upstream/master branch. In order to update the remote branch in Github, you need to push your changes

0 commit comments

Comments
 (0)