Skip to content

Commit d099668

Browse files
authored
Merge pull request #132 from C2SM/review_MS
Review and corrections to beginner's material
2 parents dff05f3 + dc70fc8 commit d099668

File tree

4 files changed

+23
-28
lines changed

4 files changed

+23
-28
lines changed

beginner/Exercise_2_switch_branches.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Objective
44

55
* Learn how to work with branches and switch between them using `git switch`.
6-
* Note: `git checkout` can be used as an alternative to `git switch`. However, it has different features that have caused confusion among users in the past. So we won't use it here, but show the alternative commands in brackets, as some older Git versions don't have this option yet.
6+
> **Note**: `git checkout` can be used as an alternative to `git switch`. However, it has different features that have caused confusion among users in the past. So we won't use it here, but show the alternative commands in brackets, as some older Git versions don't have this option yet.
77
88
## Structure
99

@@ -86,7 +86,7 @@ git branch
8686
```
8787

8888
We can easily switch between these branches using the `git switch` command.
89-
Don't worry -> Git will keep all your work done on that branch.
89+
Don't worry -> Git will keep all your committed work on that branch.
9090

9191
5. Switch back to *main* branch:
9292
```bash

beginner/Exercise_3_restore_merge.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ We can use `git restore` to get any version of a file along its Git history.
5353

5454
Just run `git restore -s <specific_commit_hash> <your_schedule>`.
5555

56-
**Note**:
56+
> **Note**:
5757
For simplicity, we've used the `-s` option in the `git restore` command. Note that `-s` is a shorthand for `--source`, which you can also use interchangeably. The primary difference lies in the syntax: use `-s <commit_hash>` for a shorter command, or `--source=<commit_hash>` if you prefer a more explicit approach. Both options perform the same function: specifying the source from which to restore. Whether you prefer `-s` for brevity or `--source` for clarity is up to you.
5858
5959
2. Undo "Change poster sessions to talks" by restoring the *schedule_day1.txt* to the commit before the change.
@@ -78,19 +78,14 @@ Each *commit hash* is unique, so you can always go to any version of the tracked
7878

7979
Your output should look similar to:
8080
```
81-
b7bd111 (HEAD -> main) Remove workshop on day1
81+
b7bd111 (HEAD -> main) Remove workshop on day 1
8282
f6c3f04 Change talks back to poster sessions
8383
5889296 Change poster sessions to talks
8484
464fc92 Add workshop
8585
e53b1e0 Add coffee break
8686
f1b23c1 Add poster sessions in the morning
8787
f636890 Add schedule_day2
8888
206f724 Add schedule_day1
89-
1c1e740 Changed poster sessions to talks
90-
154f0dc Add coffee break
91-
a98abe7 Add poster sessions in the morning
92-
ca117ca Add schedule_day2
93-
b82e094 Add schedule_day1
9489
```
9590

9691

@@ -100,11 +95,11 @@ There are two sections in *schedule_day1.txt*, which we will change on separate
10095
* *daily_program*
10196
* *evening_activity*
10297

103-
Note: Try to avoid merge conflicts by not changing the same part of a file in two branches you want to merge (usually the *main* branch and a branch you want to merge into the *main* branch). There are, of course, ways to deal with merge conflicts, and we will learn how to deal with them later in this course, but for now we will try to avoid them. If you follow the descriptions below, you should not run into a merge conflict.
98+
> **Note**: Try to avoid merge conflicts by not changing the same part of a file in two branches you want to merge (usually the *main* branch and a branch you want to merge into the *main* branch). There are, of course, ways to deal with merge conflicts, and we will learn how to deal with them later in this course, but for now we will try to avoid them. If you follow the descriptions below, you should not run into a merge conflict.
10499
105100
1. Switch to a new branch for the evening activity.
106101

107-
2. Open the schedules add evening activities.
102+
2. Open the schedules and add evening activities.
108103

109104
3. Add and commit the changes.
110105

@@ -156,16 +151,16 @@ For this merge, Git performs what is called a **3-way merge**, because the path
156151
Your Git log looks like the following:
157152
```
158153
c0d0459 (HEAD -> main) Merge daily_program
159-
b1be3b4 (daily_program) Add talk
160-
4d93eac (evening_activity) Add evening activity
161-
dd09add No more workshop
162-
cc345c6 Revert poster sessions
163-
ebc8d06 Change poster sessions to talks
164-
56c65e8 Add workshops
165-
e0ced97 Add coffee break
166-
90b9b5e Add poster sessions in the morning
167-
2a00ec0 Add schedule_day2
168-
20be4d2 Add schedule_day1
154+
b1be3b4 (daily_program) Add talks
155+
4d93eac Add evening activities
156+
b7bd111 Remove workshop on day 1
157+
f6c3f04 Change talks back to poster sessions
158+
5889296 Change poster sessions to talks
159+
464fc92 Add workshop
160+
e53b1e0 Add coffee break
161+
f1b23c1 Add poster sessions in the morning
162+
f636890 Add schedule_day2
163+
206f724 Add schedule_day1
169164
```
170165

171166
13. Again, make sure to delete the branch you just merged.

beginner/Exercise_4_workflow_gitignore.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Remember, the *.gitignore* file should be committed into your repository, so it
5959

6060
Log files are typically generated for debugging and monitoring purposes but are not meant to be part of the Git repository. Since they change frequently and can grow large, they are usually added to the *.gitignore* file to keep the repository clean and prevent unnecessary clutter.
6161

62-
5. Add a wildcart to the *.gitignore* file to exclude all log files.
62+
5. Add a wildcard to the *.gitignore* file to exclude all log files.
6363

6464
6. Check the status of *git-course* repository. Does the log file still show up?
6565

@@ -81,7 +81,7 @@ init_repo_empty_schedule
8181
7. Add and commit the changes.
8282
We continue to plan.
8383
8. Add a lunch break, another talk and a second poster session to the schedule and commit your changes.
84-
9. Check if all of your changes are really tracked by Git by checking the status und the history.
84+
9. Check if all of your changes are really tracked by Git by checking the status and the history.
8585

8686
If you don't have any untracked changes in your repository, proceed to the next part of this exercise.
8787

@@ -106,7 +106,7 @@ Thanks to Git we can easily restore files, even if they are deleted.
106106
1. Create a new branch.
107107
2. We are not sure yet if Professor X will accept the talk in the morning, therefore change the talk to a workhop on this branch as an alternative schedule.
108108
3. Add and commit your changes.
109-
4. No switch back to branch *main* and create another branch on top of it.
109+
4. Now switch back to branch *main* and create another branch on top of it.
110110

111111
We want to plan an evening activity but are not sure what it will be. Therefore, we create two branches with different activities.
112112

@@ -141,6 +141,7 @@ Decide which one you prefer.
141141
12. Delete the merge branch.
142142

143143
There is one unused branch left in our repository.
144+
144145
13. We want to keep the repository clean and nice. So please delete the unmerged branch as well.
145146

146147
**Remark:** Since we did not merge the remaining branch, it has to be done differently before. But don't worry, Git will tell you what to do.

beginner/helpers.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ get_default_branch_name() {
3535

3636
init_exercise () {
3737
cd $dir_at_startup
38-
mkdir -p ../../beginners_git
3938
rm -rf ../../beginners_git
4039
mkdir -p ../../beginners_git
4140
cd ../../beginners_git
@@ -56,7 +55,7 @@ init_repo_empty_schedule () {
5655
init_simple_repo () {
5756
cd $dir_at_startup
5857
rm -rf ../../beginners_git/conference_planning
59-
mkdir ../../beginners_git/conference_planning
58+
mkdir -p ../../beginners_git/conference_planning
6059
cd ../../beginners_git/conference_planning
6160
git init
6261

@@ -140,7 +139,7 @@ init_repo () {
140139
init_repo_remote () {
141140
cd $dir_at_startup
142141
rm -rf ../../beginners_git/conference_planning
143-
mkdir ../../beginners_git/conference_planning
142+
mkdir -p ../../beginners_git/conference_planning
144143
cd ../../beginners_git/conference_planning
145144
git init
146145

@@ -219,4 +218,4 @@ commit_to_remote_by_third_party() {
219218
rm -rf conference_planning_remote_tmp
220219

221220
cd conference_planning
222-
}
221+
}

0 commit comments

Comments
 (0)