Skip to content

Commit

Permalink
Formatting Consistency Check
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaehn committed Mar 22, 2024
1 parent dfbf1bb commit f6e3ce5
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 40 deletions.
8 changes: 4 additions & 4 deletions beginner/Exercise_1/Exercise_1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"The following helper functions in the file *helpers.sh* are written by C2SM and are **NOT** **part of Git**. They will set up simple repositories for you that have a short Git history, so that you have something to work with.\n",
"\n",
"For this exercise, we will use the following functions from this file:\n",
" * **init_exercise:** This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * **reset:** This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * `init_exercise`: This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * `reset`: This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
"\n",
"\n",
"## Remarks \n",
Expand Down Expand Up @@ -193,7 +193,7 @@
"### Make and track changes in files using `git add`, `git commit` and `git status`\n",
"\n",
"In a next step you will add some files to your repository. \n",
"To do this, we will use the *echo* command in combination with the \">\" operator to direct its\n",
"To do this, we will use the *echo* command in combination with the `>` operator to direct its\n",
"output to a file."
]
},
Expand Down Expand Up @@ -308,7 +308,7 @@
"\n",
"### Know state of Git repository using `git diff` and `git log`\n",
"Right now we have two files in our Git repository.\n",
"Let's see what happens when we modify them. We will use the \">>\" operator to append a new line of text to our files."
"Let's see what happens when we modify them. We will use the `>>` operator to append a new line of text to our files."
]
},
{
Expand Down
10 changes: 5 additions & 5 deletions beginner/Exercise_2/Exercise_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"The following helper functions in the file *helpers.sh* are written by C2SM and are **NOT** **part of Git**. They will set up simple repositories for you that have a short Git history, so that you have something to work with.\n",
"\n",
"For this exercise, we will use the following functions from this file:\n",
" * **init_exercise:** This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * **reset:** This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * **init_simple_repo:** This will set up a Git repository containing a first version of *schedule_day1.txt* and *schedule_day2.txt* on the *main* branch.\n",
" * `init_exercise`: This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * `reset`: This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * `init_simple_repo`: This will set up a Git repository containing a first version of *schedule_day1.txt* and *schedule_day2.txt* on the *main* branch.\n",
"\n",
"## Remarks\n",
"_**Reminder:** Any text enclosed in `<>` denotes a placeholder to be replaced with a specific string appropriate to your context, i.e. delete `<>` and replace it with the appropriate word._\n",
Expand Down Expand Up @@ -116,8 +116,8 @@
"metadata": {},
"source": [
"In the output above we see two files:\n",
" * schedule_day1.txt\n",
" * schedule_day2.txt\n",
" * *schedule_day1.txt*\n",
" * *schedule_day2.txt*\n",
" \n",
"Let's have a look at them using the `cat` command:"
]
Expand Down
6 changes: 3 additions & 3 deletions beginner/Exercise_3/Exercise_3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"The following helper functions in the file *helpers.sh* are written by C2SM and are **NOT** **part of Git**. They will set up simple repositories for you that have a short Git history, so that you have something to work with.\n",
"\n",
"For this exercise, we will use the following functions from this file:\n",
" * **init_exercise:** This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * **reset:** This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * **init_repo:** This sets up a Git repository as in Exercise 2, but with more commits.\n",
" * `init_exercise`: This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * `reset`: This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * `init_repo`: This sets up a Git repository as in Exercise 2, but with more commits.\n",
"\n",
"## Remarks\n",
"_**Reminder:** Any text enclosed in `<>` denotes a placeholder to be replaced with a specific string appropriate to your context, i.e. delete `<>` and replace it with the appropriate word._\n",
Expand Down
29 changes: 16 additions & 13 deletions beginner/Exercise_4/Exercise_4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
"\n",
"## Objective\n",
" * Practice the typical Git workflow\n",
" * Understand the function of a `.gitignore` file, and learn the steps involved in creating and configuring it within a Git repository.\n",
" * Understand the function of a *.gitignore* file, and learn the steps involved in creating and configuring it within a Git repository.\n",
" \n",
"## Structure\n",
"\n",
"In this exercise, we won't be learning any new Git commands. Rather, we will review all the commands and workflows we learned in the previous exercises. We will do this by working on the *conference_schedule.txt* document and simulating a possible workflow. Since this is a review, there will be less explanation for that part of this exercise.\n",
"\n",
"In addition to that, we will explore a crucial aspect of Git: the `.gitignore` file. We'll learn how to create and configure this file to manage the files that Git should ignore, enhancing our typical workflow.\n",
"In addition to that, we will explore a crucial aspect of Git: the *.gitignore* file. We'll learn how to create and configure this file to manage the files that Git should ignore, enhancing our typical workflow.\n",
"\n",
"\n",
"\n",
"## Helper Functions\n",
"The following helper functions in the file *helpers.sh* are written by C2SM and are **NOT** **part of Git**. They will set up simple repositories for you that have a short Git history, so that you have something to work with.\n",
"\n",
"For this exercise, we will use the following functions from this file:\n",
" * **init_exercise:** This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * **reset:** This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * **init_repo_empty_schedule:** This will create the directory `conference_planning` and a file `conference_schedule.txt` with an empty schedule.\n",
" * `init_exercise`: This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * `reset`: This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * `init_repo_empty_schedule`: This will create the directory *conference_planning* and a file *conference_schedule.txt* with an empty schedule.\n",
"\n",
"## Remarks\n",
"_**Reminder:** Any text enclosed in `<>` denotes a placeholder to be replaced with a specific string appropriate to your context, i.e. delete `<>` and replace it with the appropriate word._\n",
Expand Down Expand Up @@ -136,31 +136,33 @@
},
{
"cell_type": "markdown",
"id": "76a09714",
"metadata": {},
"source": [
"### Understanding `.gitignore`\n",
"### Understanding *.gitignore*\n",
"\n",
"The `.gitignore` file is an essential and commonly used feature in Git. It specifies intentionally untracked files that Git should ignore. It's particularly useful for excluding files generated during execution or build processes—like log files, compiled code, or local configuration files—that don't need to be shared within the repository. Creating a `.gitignore` file and listing the file patterns to exclude achieves this.\n",
"The *.gitignore* file is an essential and commonly used feature in Git. It specifies intentionally untracked files that Git should ignore. It's particularly useful for excluding files generated during execution or build processes—like log files, compiled code, or local configuration files—that don't need to be shared within the repository. Creating a *.gitignore* file and listing the file patterns to exclude achieves this.\n",
"\n",
"**Typical Ingredients of `.gitignore`:**\n",
"**Typical Ingredients of *.gitignore*:**\n",
"\n",
"Once your `.gitignore` is created, you can specify:\n",
"Once your *.gitignore* is created, you can specify:\n",
"\n",
"- **Patterns**: Direct patterns such as `my_file_to_ignore.txt` to exclude specific files or `my_directory_to_ignore/` to exclude specific directories. For example, `.ipynb_checkpoints/` is often added to the `.gitignore` when working with Jupyter Notebooks to ignore checkpoint folders created during development.\n",
"- **Patterns**: Direct patterns such as *my_file_to_ignore.txt* to exclude specific files or *my_directory_to_ignore/* to exclude specific directories. For example, *.ipynb_checkpoints/* is often added to the *.gitignore* when working with Jupyter Notebooks to ignore checkpoint folders created during development.\n",
"- **Wildcards**: Broad patterns like `*.log` to exclude all log files created across the project.\n",
"- **Exceptions**: If you've used a wildcard but want to track specific files, precede the exception with `!`. For instance, `!important_log.log` ensures this file is tracked despite the `*.log` exclusion.\n",
"- **Exceptions**: If you've used a wildcard but want to track specific files, precede the exception with `!`. For instance, *!important_log.log* ensures this file is tracked despite the `*.log` exclusion.\n",
"\n",
"Remember, the `.gitignore` file should be committed into your repository, so it is shared with other developers, ensuring that everyone working on the project is ignoring the same files.\n",
"Remember, the *.gitignore* file should be committed into your repository, so it is shared with other developers, ensuring that everyone working on the project is ignoring the same files.\n",
"\n",
"**Practical Application:**\n",
"\n",
"Now that you have seen and understood the concept of the `.gitignore` file, you can proceed with your exercises. At a certain point, after you run `git status`, you might notice a file named `.ipynb_checkpoints`. This is created by Jupyter Notebooks to save checkpoint files and it's exactly the type of content we aim to exclude from our Git repository, as it is specific to your local Jupyter Notebook environment. It thus presents a perfect opportunity to apply what you've just learned. Follow these steps to create a `.gitignore` and specify the patterns. Remember to add and commit your `.gitignore` after creating it. \n",
"Now that you have seen and understood the concept of the *.gitignore* file, you can proceed with your exercises. At a certain point, after you run `git status`, you might notice a file named *.ipynb_checkpoints*. This is created by Jupyter Notebooks to save checkpoint files and it's exactly the type of content we aim to exclude from our Git repository, as it is specific to your local Jupyter Notebook environment. It thus presents a perfect opportunity to apply what you've just learned. Follow these steps to create a *.gitignore* and specify the patterns. Remember to add and commit your *.gitignore* after creating it. \n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "08f11c4e",
"metadata": {
"vscode": {
"languageId": "shellscript"
Expand All @@ -175,6 +177,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b55e0f49",
"metadata": {
"vscode": {
"languageId": "shellscript"
Expand Down
7 changes: 4 additions & 3 deletions beginner/Exercise_5/Exercise_5.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"The following helper functions in the file *helpers.sh* are written by C2SM and are **NOT** **part of Git**. They will set up simple repositories for you that have a short Git history, so that you have something to work with.\n",
"\n",
"For this exercise, we will use the following functions from this file:\n",
" * **init_exercise:** This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * **reset:** This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * **init_simple_repo_remote:** This will create the same simple repository as before, along with a second repository to be used as a remote.\n",
" * `init_exercise`: This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * `reset`: This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * `init_simple_repo_remote`: This will create the same simple repository as before, along with a second repository to be used as a remote.\n",
"\n",
"## Remarks\n",
"_**Reminder:** Any text enclosed in `<>` denotes a placeholder to be replaced with a specific string appropriate to your context, i.e. delete `<>` and replace it with the appropriate word._\n",
Expand Down Expand Up @@ -313,6 +313,7 @@
},
{
"cell_type": "markdown",
"id": "c42c9642",
"metadata": {},
"source": [
"**Congrats, you now also know the most essential Git commands for the _remote_ use of Git.**"
Expand Down
34 changes: 24 additions & 10 deletions beginner/Exercise_6/Exercise_6.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"The following helper functions in the file *helpers.sh* are written by C2SM and are **NOT** **part of Git**. They will set up simple repositories for you that have a short Git history, so that you have something to work with.\n",
"\n",
"For this exercise, we will use the following functions from this file:\n",
" * **init_exercise:** This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * **reset:** This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * **init_repo_remote:** This will set up a Git repository with a first version of *schedule_day1.txt* and a remote repository containing the same version of *schedule_day1.txt* on a different branch called *updated_schedules*.\n",
" * **commit_to_remote_by_third_party:** This will make a commit to the remote Git repository to create an artificial merge conflict when pulling.\n",
" * `init_exercise`: This will create the *beginners_git* directory in the parent directory of the *git-course* directory. It will also delete any old version of the *beginners_git* directory, so don't use the *beginners_git* directory to save any work.\n",
" * `reset`: This will delete the *beginners_git* directory and allows you a clean restart of the exercise in case you messed it up completely.\n",
" * `init_repo_remote`: This will set up a Git repository with a first version of *schedule_day1.txt* and a remote repository containing the same version of *schedule_day1.txt* on a different branch called *updated_schedules*.\n",
" * `commit_to_remote_by_third_party`: This will make a commit to the remote Git repository to create an artificial merge conflict when pulling.\n",
"\n",
"## Remarks\n",
"_**Reminder:** Any text enclosed in `<>` denotes a placeholder to be replaced with a specific string appropriate to your context, i.e. delete `<>` and replace it with the appropriate word._\n",
Expand Down Expand Up @@ -248,27 +248,41 @@
},
{
"cell_type": "markdown",
"id": "automatic-underground",
"id": "b1f0a8af-8421-403f-a724-5fd4f845ab11",
"metadata": {},
"source": [
"### Solve merge conflict\n",
"If you've done everything \"right\", something went \"wrong\" and the output should look like this:\n",
"\n",
"```\n",
"CONFLICT (content): Merge conflict in schedule_day1.txt\n",
"Automatic merge failed; fix conflicts and then commit the result.\n",
"```\n",
"\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "5ebdc8d4-57c3-4fae-9f80-1f748c379dcd",
"metadata": {},
"source": [
"Looks like we run into a merge conflict. This happened because we made 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 fix this. \n",
"\n",
"Have a look into the file _schedule_day1.txt_. You will see something like this:\n",
"Have a look into the file *schedule_day1.txt*. You will see something like this:\n",
"\n",
"``` \n",
"<<<<<<< HEAD\n",
"13:30-15:00: Poster session\n",
"=======\n",
"13:30-15:00: Talk professor C.\n",
">>>>>>> updated_schedules \n",
"```\n",
"\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "a4a19cb2-7551-4394-97f0-9a9b226685d4",
"metadata": {},
"source": [
"The top line is the HEAD, referring to the branch you are currently on (here *main*), and the second line refers to the branch you wanted to merge (here *updated_schedules*).\n",
"\n",
"Here are two ways to resolve a merge conflict:\n",
Expand Down
Loading

0 comments on commit f6e3ce5

Please sign in to comment.