Skip to content

Commit

Permalink
Use .txt extensions for all files
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnikaLau committed Mar 23, 2023
1 parent 489afc8 commit 4ec9063
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 95 deletions.
18 changes: 9 additions & 9 deletions beginner/Exercise_1/Exercise_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@
"metadata": {},
"outputs": [],
"source": [
"# create a new file using the echo-command\n",
"# echo \"<my text for file>\" > first_file\n"
"# create a text file using the echo-command\n",
"# echo \"<my text for file>\" > first_file.txt\n"
]
},
{
Expand Down Expand Up @@ -229,8 +229,8 @@
"\n",
"Untracked files:\n",
" (use \"git add <file>...\" to include in what will be committed)\n",
"\tfirst_file\n",
"\tsecond_file\n",
"\tfirst_file.txt\n",
"\tsecond_file.txt\n",
"\n",
"nothing added to commit but untracked files present (use \"git add\" to track)\n",
"```\n",
Expand Down Expand Up @@ -265,8 +265,8 @@
"\n",
"Changes to be committed:\n",
" (use \"git rm --cached <file>...\" to unstage)\n",
"\tnew file: first_file\n",
"\tnew file: second_file\n",
"\tnew file: first_file.txt\n",
"\tnew file: second_file.txt\n",
"```\n",
"\n",
"The last thing to do is to commit these files. "
Expand Down Expand Up @@ -329,7 +329,7 @@
"Changes not staged for commit:\n",
" (use \"git add <file>...\" to update what will be committed)\n",
" (use \"git restore <file>...\" to discard changes in working directory)\n",
"\tmodified: first_file\n",
"\tmodified: first_file.txt\n",
"\n",
"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n",
"```\n",
Expand Down Expand Up @@ -359,8 +359,8 @@
"```\n",
"diff --git a/first_file b/first_file\n",
"index 3829ab8..a32d2f3 100644\n",
"--- a/first_file\n",
"+++ b/first_file\n",
"--- a/first_file.txt\n",
"+++ b/first_file.txt\n",
"@@ -1 +1,2 @@\n",
" myfirstline\n",
"+mysecondline\n",
Expand Down
32 changes: 16 additions & 16 deletions beginner/Exercise_2/Exercise_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
" * Note: `git checkout` can be used as an alternative for `git switch`. However, it has some other functionalities, which led to confusion among users in the past. Therefore, we will not use it here but show the alternative commands in brackets.\n",
"\n",
"## Structure\n",
"In this exercise we will work on planning a two-day conference with two files containing the schedules for day 1 and 2 (schedule_day1 and schedule_day2). For adding events to the schedules (e.g., planned talks, poster sessions, etc.), we work on separate branches to not mix things up.\n",
"In this exercise we will work on planning a two-day conference with two files containing the schedules for day 1 and 2 (schedule_day1.txt and schedule_day2.txt). For adding events to the schedules (e.g., planned talks, poster sessions, etc.), we work on separate branches to not mix things up.\n",
"Again, the exercise consists of short descriptions about a specific Git command, followed by a practical part where you can execute appropriate Git commands.\n",
"\n",
"In order to allow a smooth exercise, there are some functions written by C2SM in the file *helpers.sh* that are **NOT** part of Git. For this exercise we use the following functions from that file:\n",
" * **init_exercise:** It will create the *work* directory and navigate into it \n",
" * **reset:** It will delete the *work* folder and enable you a clean restart of the exercise in case you completely mess it up\n",
" * **init_simple_repo:** setup a Git repository containing a first version of schedule_day1 and schedule_day2 on branch *main*.\n",
" * **init_simple_repo:** setup a Git repository containing a first version of schedule_day1.txt and schedule_day2.txt on branch *main*.\n",
" \n",
"_**Reminder:** all text enclosed with `<>` denotes a placeholder to be replaced by a specific string appropriate to your context._\n",
"\n",
Expand Down Expand Up @@ -84,8 +84,8 @@
"\n",
"### Learn how to work with branches and switch between them using git switch\n",
"In the output above we see two files:\n",
" * schedule_day1\n",
" * schedule_day2\n",
" * schedule_day1.txt\n",
" * schedule_day2.txt\n",
" \n",
"Let's first have a look at them using the *cat* command:"
]
Expand All @@ -108,7 +108,7 @@
"metadata": {},
"outputs": [],
"source": [
"# display content with cat: \"cat <schedule_dayX>\"\n"
"# display content with cat: \"cat <schedule_dayX.txt>\"\n"
]
},
{
Expand All @@ -119,7 +119,7 @@
"As you see, there is still a lot of free time available to add talks, poster sessions, breaks etc.\n",
"\n",
"To keep everything in order we do this in two different Git branches:\n",
"one each for schedule_day1 and schedule_day2. \n",
"one each for schedule_day1.txt and schedule_day2.txt. \n",
"\n",
"**So let's start!**"
]
Expand All @@ -143,7 +143,7 @@
"source": [
"From now on, we do all modifications of the schedules directly via Jupyter Notebooks.\n",
" * On the start page go to folder *~/Exercise_2/work/conference_planning*\n",
" * Open *schedule_day1*\n",
" * Open *schedule_day1.txt*\n",
" * Add more information to the schedule, i.e., a planned talk or lunch\n",
" \n",
"**Do not forget to save your modifications before coming back!**\n",
Expand All @@ -158,7 +158,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Make changes to schedule_day1\n"
"# Make changes to schedule_day1.txt\n"
]
},
{
Expand All @@ -182,7 +182,7 @@
"Changes not staged for commit:\n",
" (use \"git add <file>...\" to update what will be committed)\n",
" (use \"git restore <file>...\" to discard changes in working directory)\n",
"\tmodified: schedule_day1\n",
"\tmodified: schedule_day1.txt\n",
"\n",
"no changes added to commit (use \"git add\" and/or \"git commit -a\")\n",
"```\n",
Expand All @@ -197,7 +197,7 @@
"metadata": {},
"outputs": [],
"source": [
"# add schedule_day1 and commit it\n"
"# add schedule_day1.txt and commit it\n"
]
},
{
Expand Down Expand Up @@ -245,7 +245,7 @@
"id": "adjacent-angle",
"metadata": {},
"source": [
"Create a new branch for planning day 2 and extend the schedule_day2 in that branch similar as already done for schedule_day1"
"Create a new branch for planning day 2 and extend the schedule_day2.txt in that branch similar as already done for schedule_day1.txt."
]
},
{
Expand All @@ -255,7 +255,7 @@
"metadata": {},
"outputs": [],
"source": [
"# create a new branch and edit schedule_day2\n"
"# create a new branch and edit schedule_day2.txt\n"
]
},
{
Expand Down Expand Up @@ -292,9 +292,9 @@
"```\n",
"\n",
"Our Git repository now contains:\n",
" * Branch `<meaningful_branch_name A>` with modifications of schedule_day1\n",
" * Branch `<meaningful_branch_name B>` with modifications of schedule_day2\n",
" * Branch `main` with the initial version of schedule_day1 and schedule_day2\n",
" * Branch `<meaningful_branch_name A>` with modifications of schedule_day1.txt\n",
" * Branch `<meaningful_branch_name B>` with modifications of schedule_day2.txt\n",
" * Branch `main` with the initial version of schedule_day1.txt and schedule_day2.txt\n",
" \n",
"With `git switch` it is easy to jump between these branches and modify our schedules further.\n",
"To show its capabilities we quickly switch between the branches and see how our schedules change.\n",
Expand All @@ -309,7 +309,7 @@
"metadata": {},
"outputs": [],
"source": [
"# display the content of schedule_day1 and schedule_day2 using \"cat\"\n"
"# display the content of schedule_day1.txt and schedule_day2.txt using \"cat\"\n"
]
},
{
Expand Down
28 changes: 14 additions & 14 deletions beginner/Exercise_3/Exercise_3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
" * Delete unused branches\n",
" \n",
"## Structure\n",
"In this exercise we will continue working on planning the two-day conference using schedule_day1 and schedule_day2 for planning each day. First we need to revert the schedules to a specific commit. Then we modify the same file, but in different branches. Finally, we merge all our changes into branch main.\n",
"In this exercise we will continue working on planning the two-day conference using schedule_day1.txt and schedule_day2.txt for planning each day. First we need to revert the schedules to a specific commit. Then we modify the same file, but in different branches. Finally, we merge all our changes into branch main.\n",
"\n",
"Again the exercise consists of short descriptions about a specific Git command (less detailed than in previous exercises), followed by a hands-on part for you to execute appropiate git commands.\n",
"\n",
Expand Down Expand Up @@ -105,7 +105,7 @@
"source": [
"To see the schedules or make changes we use the Jupyter Notebook again:\n",
" * On the start page go to folder *~/Exercise_3/work/conference_planning*\n",
" * Open *schedule_day1* and *schedule_day2*\n",
" * Open *schedule_day1.txt* and *schedule_day2.txt*\n",
" \n",
"As you can see, the schedules of both days now start with talks.\n",
"\n",
Expand All @@ -119,7 +119,7 @@
"\n",
"Simply execute `git restore --source=<specific_commit_hash> <your_schedule>`.\n",
"\n",
"Let's try it out for schedule_day1 first!"
"Let's try it out for schedule_day1.txt first!"
]
},
{
Expand All @@ -129,7 +129,7 @@
"metadata": {},
"outputs": [],
"source": [
"# restore the version of schedule_day1 before commit: \"Change poster sessions to talks\"\n",
"# restore the version of schedule_day1.txt before commit: \"Change poster sessions to talks\"\n",
"# \"git restore --source=<commit_hash> <file_to_restore>\"\n",
"# (Alternative - includes 'git add': git checkout <commit_hash> <file_to_restore>)\n"
]
Expand All @@ -139,10 +139,10 @@
"id": "realistic-worship",
"metadata": {},
"source": [
"Refresh the jupyter notebook page showing schedule_day1 and have a look at it.\n",
"Refresh the jupyter notebook page showing schedule_day1.txt and have a look at it.\n",
"You see, we now have a poster session in the morning again.\n",
"\n",
"Do the same for schedule_day2."
"Do the same for schedule_day2.txt."
]
},
{
Expand All @@ -152,7 +152,7 @@
"metadata": {},
"outputs": [],
"source": [
"# restore schedule_day2 before commit \"Change poster sessions to talks\"\n"
"# restore schedule_day2.txt before commit \"Change poster sessions to talks\"\n"
]
},
{
Expand Down Expand Up @@ -185,7 +185,7 @@
"Every *commit hash* is unique, so you can always go to any version of the tracked files, *also* across different branches.\n",
"\n",
"All of a sudden we decide to not have the workshop on day 1 anymore. Therefore\n",
"restore schedule_day1 before the commit \"Add workshops\""
"restore schedule_day1.txt before the commit \"Add workshops\""
]
},
{
Expand All @@ -195,9 +195,9 @@
"metadata": {},
"outputs": [],
"source": [
"# restore schedule_day1 at right commit\n",
"# restore schedule_day1.txt at right commit\n",
"\n",
"# commit schedule_day1\n"
"# commit schedule_day1.txt\n"
]
},
{
Expand Down Expand Up @@ -239,8 +239,8 @@
"metadata": {},
"source": [
"### Merge two branches (without merge conflicts)\n",
"In this part of the excercise we continue writing on *schedule_day1*.\n",
"There are two sections in schedule_day1 to modify in a seperate branch:\n",
"In this part of the excercise we continue writing on *schedule_day1.txt*.\n",
"There are two sections in schedule_day1.txt to modify in a seperate branch:\n",
" * daily-program\n",
" * evening activity\n",
" \n",
Expand All @@ -264,7 +264,7 @@
"source": [
"To edit the schedules use jupyter notebook as described before.\n",
" \n",
"**Do not forget to save schedule_day1 before coming back here**"
"**Do not forget to save schedule_day1.txt before coming back here**"
]
},
{
Expand Down Expand Up @@ -399,7 +399,7 @@
"metadata": {},
"outputs": [],
"source": [
"# display content of schedule_day1 using \"cat\"\n"
"# display content of schedule_day1.txt using \"cat\"\n"
]
},
{
Expand Down
10 changes: 1 addition & 9 deletions beginner/Exercise_5/Exercise_5.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"Make a change in your local repository.\n",
"Remember to do all modifications of the schedules directly via Jupyter Notebooks:\n",
" * Go to folder *work* and enter *conference_planning*\n",
" * Open *schedule_day1*\n",
" * Open *schedule_day1.txt*\n",
" * Add more information to your schedule, i.e. talks, workshops, etc.\n",
" \n",
"**Don't forget to save your modifications before coming back!**"
Expand Down Expand Up @@ -302,14 +302,6 @@
" 1dacf13..80e64e8 updated_schedules -> updated_schedules\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aea143c9",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
22 changes: 11 additions & 11 deletions beginner/Exercise_6/Exercise_6.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"In order to allow a smooth exercise, there are some functions written by C2SM in the file *helpers.sh* that are **NOT** part of Git. For this exercise we use the following functions from that file:\n",
" * **init_exercise:** It will create the *work* directory and navigate into it \n",
" * **reset:** It will delete the *work* folder and enable you a clean restart of the exercise in case you completely mess it up\n",
" * **init_repo_remote:** setup a Git repository containing a first version of _schedule_day1_ and a remote repo containing the same version of _schedule_day1_ on a different branch called \"updated_schedules\".\n",
" * **init_repo_remote:** setup a Git repository containing a first version of _schedule_day1.txt_ and a remote repo containing the same version of _schedule_day1.txt_ on a different branch called \"updated_schedules\".\n",
"\n",
"_**Reminder:** all text enclosed with `<>` denotes a placeholder to be replaced by a specific string appropriate in your context._\n",
"\n",
Expand Down Expand Up @@ -85,7 +85,7 @@
"***\n",
"## Exercise\n",
"\n",
"In this exercise we are going to use a repository together with a remote repository containing the file _schedule_day1_. Let's initialize it with our helper function."
"In this exercise we are going to use a repository together with a remote repository containing the file _schedule_day1.txt_. Let's initialize it with our helper function."
]
},
{
Expand All @@ -107,7 +107,7 @@
"### Now let's make a change in the schedule and commit it\n",
"Remember to do all modifications of the schedules directly via Jupyter Notebooks:\n",
" * Go to folder ~*Exercise_6/work/conference_planning*\n",
" * Open _schedule_day1_\n",
" * Open _schedule_day1.txt_\n",
" * Change the workshop to a poster session"
]
},
Expand Down Expand Up @@ -166,7 +166,7 @@
"source": [
"### Now make a different change in the same file on the _updated_schedules_ branch\n",
" * Switch to the _**updated_schedules**_ branch\n",
" * Change the workshop to a talk in ~*Exercise_6/work/conference_planning/schedule_day1*\n",
" * Change the workshop to a talk in ~*Exercise_6/work/conference_planning/schedule_day1.txt*\n",
" * Commit your changes"
]
},
Expand Down Expand Up @@ -220,13 +220,13 @@
"### Solve merge conflict\n",
"If you've done everything \"right\", something has gone \"wrong\" and the output should look like the following:\n",
"```\n",
"CONFLICT (content): Merge conflict in schedule_day1\n",
"CONFLICT (content): Merge conflict in schedule_day1.txt\n",
"Automatic merge failed; fix conflicts and then commit the result.\n",
"```\n",
"\n",
"We apparently run into a merge conflict. This happened because we did changes on the _**main**_ branch and the _**updated_schedules**_ branch at the same part of the file and Git doesn't know which changes it should take. Let's see how to solve this. \n",
"\n",
"Have a look into the file _schedule_day1_. You will see something like this:\n",
"Have a look into the file _schedule_day1.txt_. You will see something like this:\n",
"``` \n",
"<<<<<<< HEAD\n",
"13:30-15:00: Poster session\n",
Expand All @@ -241,9 +241,9 @@
"\n",
"1) If you are afraid that everything is messed up and you don't know what to do, just run ```git merge --abort``` and everything is set back to what it was before you were trying to merge.\n",
"\n",
"2) You can adapt the file directly and delete the lines, which were added by the merge conflict except the lines you want to keep. Now the merge conflict is solved and you can add _schedule_day1_ and finally make a commit of the merge.\n",
"2) You can adapt the file directly and delete the lines, which were added by the merge conflict except the lines you want to keep. Now the merge conflict is solved and you can add _schedule_day1.txt_ and finally make a commit of the merge.\n",
"\n",
"3) If you know you want to just use the file on the _**HEAD**_ branch (_ours_) or on the merging branch (_theirs_), you can select the preferred version with ```git restore schedule_day1 --ours``` or ```git restore schedule_day1 --theirs``` respectively. The restored file needs to be added before the final merge is being committed.\n",
"3) If you know you want to just use the file on the _**HEAD**_ branch (_ours_) or on the merging branch (_theirs_), you can select the preferred version with ```git restore schedule_day1.txt --ours``` or ```git restore schedule_day1.txt --theirs``` respectively. The restored file needs to be added before the final merge is being committed.\n",
"\n",
"Let's try all of the three versions!"
]
Expand Down Expand Up @@ -301,7 +301,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Stage schedule_day1 and finalize the merge commit (don't forget to add a commit message)\n"
"# Stage schedule_day1.txt and finalize the merge commit (don't forget to add a commit message)\n"
]
},
{
Expand Down Expand Up @@ -358,7 +358,7 @@
"id": "58fe9568",
"metadata": {},
"source": [
"Now try to solve the merge conflict with ```git restore schedule_day1 --theirs/ours```."
"Now try to solve the merge conflict with ```git restore schedule_day1.txt --theirs/ours```."
]
},
{
Expand Down Expand Up @@ -387,7 +387,7 @@
"metadata": {},
"source": [
"### Merge conflict when trying to pull remote branch\n",
"We just realized that we forgot an introduction talk to the conference. Switch to the _**updated_schedules**_ branch and change the first event to \"Introduction\" in _~/conference_planning/schedule_day1_ and commit your changes."
"We just realized that we forgot an introduction talk to the conference. Switch to the _**updated_schedules**_ branch and change the first event to \"Introduction\" in _~/conference_planning/schedule_day1.txt_ and commit your changes."
]
},
{
Expand Down
Loading

0 comments on commit 4ec9063

Please sign in to comment.