You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: forking_workflow.md
+32-18Lines changed: 32 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -1,32 +1,45 @@
1
1
# Forking Workflow
2
2
3
3
## Intro
4
-
Welcome to the Forking Workflow tutorial! Here we will demonstrate a workflow that allows for collaborative development of a shared code repository. It has the features:
5
-
- individual developers "fork" some shared repository
6
-
- development occurs on individual, forked remote/local repositories
7
-
- individual development gets integrated into shared repository through Pull Requests (PRs)
4
+
Welcome to the Forking Workflow tutorial! Here we will demonstrate a workflow that allows for collaborative development of a shared code repository. In brief, the "Forking Workflow" can be described as:
5
+
- Individual developers "fork" some shared repository
6
+
- Development occurs on individual, forked repositories
7
+
- Individual development gets integrated into shared repository through Pull Requests (PRs)
8
+
9
+
10
+
The Forking Workflow involves 3 different repositories:
11
+
-**Upstream, or "Parent" Repo**: This remote repository belongs to some organization that is not the individual developer. Maintainers of this repository control who gets to make changes, and can review/accept/decline and incoming changes through pull requests.
12
+
-**Origin, or "Forked Remote" Repo**: This remote repository is a fork of the "Parent", and belongs to the individual developer. Any changes made here are separate from the parent. The individual developer can create pull requests from this repo to the parent.
13
+
-**Local Repo**: This is the local repo on the device of the individual developer, and it is where development occurs. It is a clone of the "Forked Remote" repo.
**Honorable mention**: There is a separate workflow that you may encounter which uses branches within the same repository to achieve similar affects. There is a tutorial for that as well: https://github.com/pqz317/cnc_github_tutorial/blob/main/feature_branch_workflow.md
17
+
18
+
**Note**: There is a separate workflow that you may encounter which uses branches within the same repository to achieve similar affects. There is a tutorial for that as well: https://github.com/pqz317/cnc_github_tutorial/blob/main/feature_branch_workflow.md
11
19
12
20
The steps through this demo are:
13
-
1. Fork this repo on Github
14
-
2. Clone this forked repo to a local repo
21
+
1. Fork this "Parent" Repo to create a "Forked" Repo
22
+
2. Clone the "Forked" Repo to create a Local Repo
15
23
3. Make local changes
16
-
4. Push your changes to your forked repo on Github
17
-
5.Creating a Pull Request to integrate your changes into the "parent" repo
18
-
6.Fetching changes from the parent repo to your local repo
19
-
7. (Potentially) resolving
24
+
4. Push your changes to your "Forked" repo on Github
25
+
5.Create a Pull Request to integrate your changes into the "Parent" repo
26
+
6.Fetch changes from the parent repo to your local repo
27
+
7. (Potentially) Resolve merge conflicts
20
28
21
-
## 1. Forking a Repo
22
-
If there is an existing remote repository you'd like to start development on, usually the first thing to do would be to create a "fork" of this repository for yourself. This provides you with a repository on Github that is a clone of its "parent", where you can do any type of development and testing on without affecting the parent.
23
-
Fork this repo with
29
+
## 1. Fork this "Parent" Repo to create a "Forked" Repo
30
+
Say there is an existing remote repository that belongs to some organization, and you'd like to start development on it, usually the first thing to do would be to create a "fork" of this repository for yourself. This provides you with a repository on Github that is a clone of its "parent", where you can do any type of development and testing on without affecting the parent.
24
31
25
-
For this repo, the command to run locally will be:
32
+
For this tutorial, you can fork this repo with the "fork" button on Github:
33
+
<imgwidth="1000"alt="Screen Shot 2022-06-27 at 7 00 30 PM"src="https://user-images.githubusercontent.com/97498519/176095938-ef63421c-a878-426b-bcfb-2a3e736d3b2c.png">
34
+
You have now successfully "forked" the `cnc_github_tutorial` repo, and created a new repo that is `<YOUR_USERNAME>/cnc_github_tutorial`
35
+
36
+
37
+
## 2. Clone the "Forked" Repo to create a Local Repo
38
+
Your "forked" repo still only lives on Github, so to obtain a local copy of it and begin developing, run
The URL can always be found under the "Clone" Section of the Github page of the repo:
42
+
The URL can always be found under the "Clone" Section of the Github page of your "forked" repo:
30
43
<imgwidth="800"alt="Screen Shot 2022-06-27 at 9 42 45 AM"src="https://user-images.githubusercontent.com/97498519/175992957-a6794a57-b257-474e-b2ef-73859bfe40d2.png">
31
44
Once cloned, you should have a directory `cnc_github_tutorial` in your local filesystem. Run `git status` to verify that the directory is a git repository, and that you are on the `main` branch. An example output:
32
45
```
@@ -36,7 +49,8 @@ Your branch is up to date with 'origin/main'.
36
49
37
50
nothing to commit, working tree clean
38
51
```
39
-
You have now successfully cloned a repo!
52
+
53
+
40
54
41
55
## 2. Creating a new local branch
42
56
One general convention is to keep your local `main` branch tracking the `main` in the remote, and perform any development on a different branch
0 commit comments