|
1 | 1 | # Git Exercise |
2 | 2 |
|
| 3 | +[](https://creativecommons.org/licenses/by-nc-sa/4.0/) |
| 4 | + |
| 5 | + |
3 | 6 | ## Guidelines |
4 | 7 |
|
5 | 8 | 1. Fork this repo and clone your forked repo locally. **Make sure you fork ALL branches, not only `main`** |
6 | | -2. Answer the below questions, commit your results and push them to the forked repo (make sure you push all the involved branches). |
7 | | -3. Create a PR from branch `main` of your forked repo into `main` of the original repo. |
8 | | -4. Make sure you pass automatic tests. |
| 9 | +2. Answer the below questions, commit your results and push them (make sure you push all the involved branches). |
| 10 | +3. Check GitHub Actions **in your forked repo** (you may need to enable it) for test results. Make sure you pass the automatic tests of the **Students Presubmit Fork Tests** workflow. |
9 | 11 |
|
10 | 12 | ## Branches |
11 | 13 |
|
12 | 14 | Create the following git commit tree. You can add any file you want in each commit. |
13 | 15 | The message for each commit is denoted in the graph (`c1`, `c2`,..., `c12`). |
14 | | -Note the (lightweight) tags in commit `c4` and `c8`. |
| 16 | +Note the (lightweight) tags in the merge commits and commit `c8`. |
15 | 17 | Make sure to create exactly these names for branches and commit messages. |
16 | 18 |
|
17 | 19 | The parent commit of `c1` should be the last commit in branch `main` after a fresh clone of this repo (commit with message `start here`). |
@@ -48,7 +50,7 @@ gitGraph |
48 | 50 | **Notes**: |
49 | 51 |
|
50 | 52 | - If you've messed up the repo, you can always checkout branch main and run `git reset --hard <commit-id>` where `<commit-id>` is the commit hash from which you need to start. |
51 | | -- By default, your tags are'nt being pushed to remote. Make sure to push your tags using the `--tags` flag in the `git push` command. |
| 53 | +- By default, your tags aren't being pushed to remote. Make sure to push your tags using the `--tags` flag in the `git push` command. |
52 | 54 |
|
53 | 55 | ### Test it locally |
54 | 56 |
|
@@ -131,7 +133,7 @@ The branch content should be identical to what it was before your fix, except th |
131 | 133 | There are many approaches to solve it, some are using `git reset --hard`, `git rebase` or `git cherry-pick`. Find your preferred way. |
132 | 134 | You should find the branch contains the vulnerable data, learn its structure and data, and remove the vulnerable commit carefully, without loosing data committed in other commits. |
133 | 135 |
|
134 | | -Since you've changed the commit history, you may be needing to `--force`fully push your fixed branch to remote. |
| 136 | +The commit shouldn't be found also in remote branches. Since you've changed the commit history, you may be needing to `--force`fully push your fixed branch to remote. |
135 | 137 |
|
136 | 138 | In order to prevent this vulnerability in the future, integrate [pre commit](https://pre-commit.com/) into your repo, and add a plugin that blocks any commits that contains AWS credentials data. |
137 | 139 | Verify that the tool is working - try to commit the below text and make sure pre-commit is blocking you. |
@@ -185,11 +187,11 @@ You have been assigned the task of merging two different Git repositories, each |
185 | 187 | The repositories were maintained by separate teams and have separate commit histories. |
186 | 188 | Your goal is to **preserve the entire commit history** of both repositories while merging the code into a single Git repository, ensuring that the microservices remain functional and properly integrated with each other. |
187 | 189 |
|
188 | | -Merge the [GitExerciseOther](https://github.com/alonitac/GitExerciseOther.git) repo into this (GitExercise) repository. |
| 190 | +Merge the [GitExerciseOther](https://github.com/alonitac/GitExerciseOther.git) repo into this (GitProject) repository. |
189 | 191 | The `main` branch of the monorepo should have the following file structure: |
190 | 192 |
|
191 | 193 | ```text |
192 | | -GitExercise |
| 194 | +GitProject |
193 | 195 | └── serviceA/ |
194 | 196 | ├── [service A files...] |
195 | 197 | serviceB/ |
|
0 commit comments