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: beginner/Exercise_2_switch_branches.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
## Objective
4
4
5
5
* 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.
7
7
8
8
## Structure
9
9
@@ -86,7 +86,7 @@ git branch
86
86
```
87
87
88
88
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.
Copy file name to clipboardExpand all lines: beginner/Exercise_3_restore_merge.md
+14-19Lines changed: 14 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ We can use `git restore` to get any version of a file along its Git history.
53
53
54
54
Just run `git restore -s <specific_commit_hash> <your_schedule>`.
55
55
56
-
**Note**:
56
+
> **Note**:
57
57
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.
58
58
59
59
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
78
78
79
79
Your output should look similar to:
80
80
```
81
-
b7bd111 (HEAD -> main) Remove workshop on day1
81
+
b7bd111 (HEAD -> main) Remove workshop on day 1
82
82
f6c3f04 Change talks back to poster sessions
83
83
5889296 Change poster sessions to talks
84
84
464fc92 Add workshop
85
85
e53b1e0 Add coffee break
86
86
f1b23c1 Add poster sessions in the morning
87
87
f636890 Add schedule_day2
88
88
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
94
89
```
95
90
96
91
@@ -100,11 +95,11 @@ There are two sections in *schedule_day1.txt*, which we will change on separate
100
95
**daily_program*
101
96
**evening_activity*
102
97
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.
104
99
105
100
1. Switch to a new branch for the evening activity.
106
101
107
-
2. Open the schedules add evening activities.
102
+
2. Open the schedules and add evening activities.
108
103
109
104
3. Add and commit the changes.
110
105
@@ -156,16 +151,16 @@ For this merge, Git performs what is called a **3-way merge**, because the path
156
151
Your Git log looks like the following:
157
152
```
158
153
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
169
164
```
170
165
171
166
13. Again, make sure to delete the branch you just merged.
Copy file name to clipboardExpand all lines: beginner/Exercise_4_workflow_gitignore.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -59,7 +59,7 @@ Remember, the *.gitignore* file should be committed into your repository, so it
59
59
60
60
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.
61
61
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.
63
63
64
64
6. Check the status of *git-course* repository. Does the log file still show up?
65
65
@@ -81,7 +81,7 @@ init_repo_empty_schedule
81
81
7. Add and commit the changes.
82
82
We continue to plan.
83
83
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.
85
85
86
86
If you don't have any untracked changes in your repository, proceed to the next part of this exercise.
87
87
@@ -106,7 +106,7 @@ Thanks to Git we can easily restore files, even if they are deleted.
106
106
1. Create a new branch.
107
107
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.
108
108
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.
110
110
111
111
We want to plan an evening activity but are not sure what it will be. Therefore, we create two branches with different activities.
112
112
@@ -141,6 +141,7 @@ Decide which one you prefer.
141
141
12. Delete the merge branch.
142
142
143
143
There is one unused branch left in our repository.
144
+
144
145
13. We want to keep the repository clean and nice. So please delete the unmerged branch as well.
145
146
146
147
**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.
0 commit comments