Skip to content

Commit 449200d

Browse files
Add VSCode workflow to steps 1-4
1 parent 64ff0b2 commit 449200d

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

forking_workflow.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ The steps through this demo are:
2626
6. Fetch changes from the parent repo to your local repo
2727
7. (Potentially) Resolve merge conflicts
2828

29+
2930
## 1. Fork this "Parent" Repo to create a "Forked" Repo
3031
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.
3132

3233
For this tutorial, you can fork this repo with the "fork" button on Github:
3334
<img width="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">
35+
3436
You have now successfully "forked" the `cnc_github_tutorial` repo, and created a new repo that is `<YOUR_USERNAME>/cnc_github_tutorial`
3537

3638

@@ -41,6 +43,7 @@ git clone https://github.com/<YOUR_USERNAME>/cnc_github_tutorial.git
4143
```
4244
The URL can always be found under the "Clone" Section of the Github page of your "forked" repo:
4345
<img width="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">
46+
4447
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:
4548
```
4649
Patricks-MacBook-Pro:cnc_github_tutorial patrick$ git status
@@ -53,22 +56,63 @@ nothing to commit, working tree clean
5356
```
5457
git remote add upstream https://github.com/uwcnc/cnc_github_tutorial.git
5558
```
56-
This will tell your local git repo about another remote repo, and name it upstream. This will come in handy when there are changes to the parent repo you want to keep track of locally.
59+
This will tell your local git repo about another remote repo, and name it upstream. This will come in handy when there are changes to the "Parent" repo you want to keep track of locally.
60+
61+
### **To do this in VSCode:**
62+
63+
Open a new window and "Clone Git Repository":
64+
![01_vscode_welcome_inked](https://user-images.githubusercontent.com/91637560/176282400-1a05da04-0280-47e0-bb6b-ad517545b5fb.jpg)
65+
66+
Paste the clone URL and create a local directory `cnc_github_tutorial` for the repository location:
67+
![02_vscode_cloneURL](https://user-images.githubusercontent.com/91637560/176283021-f46afeca-90ff-4fe8-8c59-9e42ed981ca4.PNG)
68+
69+
Check/change what branch you're on in the bottom left corner:
70+
![04_branch](https://user-images.githubusercontent.com/91637560/176284703-2a052218-a1cd-4180-9b04-44dbe842f0f1.PNG)
71+
72+
Add the remote "Parent" repo by opening the Command Palette (Ctrl+Shift+P) and typing `Git: Add Remote`:
73+
![image](https://user-images.githubusercontent.com/91637560/176289001-adaaf1e3-73f3-4bcb-add5-042edb2fffa6.png)
74+
75+
Paste the parent URL (found under the "Clone" section on Github):
76+
![image](https://user-images.githubusercontent.com/91637560/176289478-861f6c9e-d755-459c-bbd1-58345f44e9db.png)
77+
78+
Name the "Parent" repo `upstream`:
79+
![image](https://user-images.githubusercontent.com/91637560/176290365-b1fdd234-8979-409d-98de-f37e2125f803.png)
80+
81+
Now you have access to local, remote (origin), and remote parent (upstream) branches:
82+
![image](https://user-images.githubusercontent.com/91637560/176294456-3d057a92-155c-4243-9e63-4d6fe83d5d36.png)
83+
5784

5885
## 3. Make local changes
5986
In your local repository, feel free to make any changes you'd like. For simplicity, you can create a new file `<YOUR_NAME>_test.txt` and add some text to it. Once that is saved, remember to `git add` and `git commit` your changes:
6087
```
6188
git add . && git commit -m "created new file"
6289
```
6390

91+
### **To do this in VSCode:**
92+
93+
Find the "Source Control" tab on the left panel and select the file you have created/modified to see a side-by-side comparison of the changes:
94+
![08_changes](https://user-images.githubusercontent.com/91637560/176285647-d6b56a4f-7c29-4ad4-8ed9-b47fc2249e09.PNG)
95+
96+
Use "+" to stage changes to specific files or stage all changes:
97+
![09_stagechanges](https://user-images.githubusercontent.com/91637560/176286062-4e64258b-0b36-49bd-82bd-698a483601d0.PNG)
98+
99+
Add a commit message and use "✓" to commit the staged changes:
100+
![10_commitchanges](https://user-images.githubusercontent.com/91637560/176286244-517f9ba3-62cd-47ab-8487-d9e6f8588a51.PNG)
101+
102+
64103
## 4. Push your changes to your "Forked" repo on Github
65104
You've made and commited changes to your local repository, now its time to push your changes to your "Forked" remote repo on Github!
66-
run:
105+
106+
Run:
67107
```
68108
git push origin master
69109
```
70110
Doing so both backs up your changes, and gets you ready to create a pull request. Note again, origin here is referring to the forked remote repo.
71111

112+
### **To do this in VSCode:**
113+
"Sync Changes" on the "Source Control" tab or simply use the sync button in the bottom left corner:
114+
![12_pushchanges_inked](https://user-images.githubusercontent.com/91637560/176287487-a3f7a27b-0165-4440-8201-036b100d0070.jpg)
115+
72116

73117
## 5. Create a Pull Request to integrate your changes into the "Parent" repo
74118
Now, to integrate your changes into the "Parent" repo, you can create a Pull Request via Github.

0 commit comments

Comments
 (0)