Skip to content

Commit 3d460ae

Browse files
committed
clarification : make the git commits more explicit and less prone to error if extra files are present.
1 parent bea688d commit 3d460ae

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

episodes/10-CI.Rmd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ This is a simple GitHub Action that runs the tests for your code whenever a pull
107107
108108
Now that you have created the `tests.yaml` file, you need to upload it to GitHub.
109109

110-
- Commit the changes using `git add .` and `git commit -m "Add GitHub Action to run tests"`
110+
- Commit the changes using `git add .github/workflows/tests.yaml` and `git commit -m "Add GitHub Action to run tests"`
111111
- Push the changes to GitHub using `git push origin main`
112112

113113
## Enable running the tests on a Pull Request
@@ -143,14 +143,16 @@ def test_subtract():
143143
assert subtract(5, 3) == 2
144144
```
145145

146-
- Commit the changes using `git add .` and `git commit -m "Add subtract function"`
146+
- Commit the changes using `git add -u .` and `git commit -m "Add subtract function"`
147+
- (The `-u` flag tells git to add only files that have been modified, not new files. This is useful when
148+
you may have temporary new files that you don't want to add.)
147149
- Push the changes to GitHub using `git push origin subtract`
148150

149151
- Now go to your GitHub repository and create a new Pull Request to merge the `subtract` branch into `main`
150152

151153
You should see that the GitHub Action runs the tests and fails because the test for the `subtract` function is failing.
152154

153-
- Let's now fix the test and commit the changes: `git add .` and `git commit -m "Fix subtract function"`
155+
- Let's now fix the test and commit the changes: `git add -u .` and `git commit -m "Fix subtract function"`
154156
- Push the changes to GitHub using `git push origin subtract` again
155157
- Go back to the Pull Request on GitHub and you should see that the tests are now passing and you can merge the code into the main branch.
156158

0 commit comments

Comments
 (0)