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: lectures/software_engineering/version_control.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ We assume that you have followed the {doc}`VS Code <../software_engineering/tool
45
45
1. Make sure you create an account on [GitHub.com](http://github.com/).
46
46
* If you are a student, consider signing up for the GitHub [Student Developer Pack](https://education.github.com/pack/) which gives you free [GitHub Pro](https://docs.github.com/en/get-started/learning-about-github/githubs-products#github-pro)
47
47
* Otherwise, see if you qualify for a free [Research or Educator Plan](https://help.github.com/articles/about-github-education-for-educators-and-researchers/) which gives you free [GitHub Team](https://docs.github.com/en/get-started/learning-about-github/githubs-products#github-team)
48
-
2. Ensure that [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git/) is installed (as it likely was in the {doc}`getting started <../getting_started_julia/getting_started>`
48
+
2. Ensure that [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git/) is installed (as it likely was in the {doc}`getting started <../getting_started_julia/getting_started>`)
49
49
3. Setup your git username, and change default line-endings if on Windows
50
50
1. Opening a terminal (on Windows you can use a powershell or the new "Git Bash" installed in the previous step)
51
51
2. Running the following, where the first two lines are not required on linux and OS/X, and you should replace the email and name in the final lines
@@ -139,11 +139,11 @@ We can then configure repository options as such
139
139
In this case, we're making a public repo `github.com/USERNAME/example_repository` where `USERNAME` is your GitHub account name. The options chosen are:
140
140
- Add in a `README.md`.
141
141
- License under the MIT open-source License.
142
-
- Ignore Julia compilation byproducts in the `.gitignore`
142
+
- Ignore Julia compilation byproducts in the `.gitignore`.
143
143
- Leave off support for the Marketplace Apps `Codecov`, which we will discuss further in the {doc}`testing lecture <../software_engineering/testing>` lecture.
144
144
145
145
```{note}
146
-
You can also add an existing folder as a new repository on github, where you can use the VS Code features to [initialize and publish](https://code.visualstudio.com/docs/editor/versioncontrol#_initialize-a-repository) a repository to GitHub. Otherwise, the [instructions are more involved](https://docs.github.com/en/github/importing-your-projects-to-github/importing-source-code-to-github/.
146
+
You can also add an existing folder as a new repository on github, where you can use the VS Code features to [initialize and publish](https://code.visualstudio.com/docs/editor/versioncontrol#_initialize-a-repository) a repository to GitHub. Otherwise, the [instructions are more involved](https://docs.github.com/en/github/importing-your-projects-to-github/importing-source-code-to-github/).
147
147
```
148
148
(clone_repo)=
149
149
### Cloning a Repository
@@ -163,8 +163,8 @@ This dropdown gives us a few options
163
163
164
164
165
165
We will download the repository using the built-in VS Code support.
166
-
1. Copy the https URL in that dropdown (e.g. `https://github.com/USERNAME/example_repository.git`)
167
-
2. Start VS Code
166
+
1. Copy the https URL in that dropdown (e.g. `https://github.com/USERNAME/example_repository.git`).
167
+
2. Start VS Code.
168
168
3. Use `Ctrl+Shift+P` to open the command bar, and choose `> Git: Clone`
169
169
4. At this point, you can paste in the copied URL or choose `Clone from GitHub` and then it will let you select your repositories after logging in.
170
170
```{figure} /_static/figures/vs-code-clone.png
@@ -183,7 +183,7 @@ You will see the automatically generated files for the `LICENSE, .gitignore` and
183
183
To manually clone this to your desktop, you can start a terminal and use `git clone https://github.com/USERNAME/example_repository.git` within the directory you want to clone it to. After cloning, you can open the folder within VS Code by either
184
184
- Within a terminal on your operating system, navigate to that directory and type `code .`
185
185
- On Windows if you installed VS Code with the appropriate option, right click on the folder and choose `Open with Code` - trusting the authors as required on opening the folder.
186
-
- In the VS Code Menu, choose `File/Open Folder...`
186
+
- In the VS Code Menu, choose `File/Open Folder...`.
187
187
```
188
188
189
189
### Making, Committing, and Pushing Changes
@@ -192,7 +192,7 @@ Now that we have the repository, we can start working with it.
192
192
193
193
Within VS Code, make the following changes:
194
194
1. Open the `README.md` and add some text.
195
-
2. Add a new file called `some_file.txt` with some text in it. You can do this with the menus, or by right clicking in the Files panel and selecting "New File"
195
+
2. Add a new file called `some_file.txt` with some text in it. You can do this with the menus, or by right clicking in the Files panel and selecting "New File".
196
196
3. Add another new file called `garbage_file.tmp` with some text in it.
197
197
4. Finally, in the `.gitignore`, add `*.tmp` at the end.
198
198
@@ -284,7 +284,7 @@ Go back to the desktop VS Code, and you will see that the Git bar at the bottom
284
284
```
285
285
Notice that the direction of the arrow is the opposite of when we made local modifications. Whereas moving local commits to the server is called a "Push", bringing external changes down to your desktop is called a "Pull".
286
286
287
-
But before we pull these changes, we will show how Git can automatically merge them - often on the same file, but at different lines of code).
287
+
But before we pull these changes, we will show how Git can automatically merge them (often on the same file, but at different lines of code).
288
288
289
289
On your local VS Code, open the `README.txt` and change the title from `# example_repository` to `# example_repository_modified`. Then save and commit this change with a commit message such as `Local Modification`. It is important that you modified the top line, and not the same one that you changed in the online editor.
290
290
@@ -307,7 +307,7 @@ The `.gitignore` is very useful for ensuring that some files are always ignored.
307
307
To see this workflow prior to making a commit:
308
308
1. Save a change to the `README.md`
309
309
2. Open the Git pane, which will show the one modification.
310
-
3. Right click on the modification you wish to discard (can be file-by-file)
310
+
3. Right click on the modification you wish to discard (can be file-by-file).
311
311
```{figure} /_static/figures/vs-code-edits-8.png
312
312
:width: 100%
313
313
```
@@ -374,7 +374,7 @@ An alternative workflow is to right click on the file, and choose `Accept All Cu
374
374
375
375
After modifying:
376
376
1. Save the file if you have resolved the merge conflict.
377
-
2. Choose the `+` next to the modified file in the source control pane, or right click on the file and choose `Stage Changes`
377
+
2. Choose the `+` next to the modified file in the source control pane, or right click on the file and choose `Stage Changes`.
378
378
3. Add a commit message, commit the file
379
379
4. Do a Push to synchronize with the server.
380
380
@@ -437,7 +437,7 @@ The checkboxes are common in GitHub to manage project tasks.
437
437
438
438
Whenever people push to a project you're working on, you'll receive an email notification.
439
439
440
-
You review individual commits by opening a commits and commenting
440
+
You review individual commits by opening a commits and commenting.
0 commit comments