From fd14f579a88973857454985299ac4c11dbcb04a4 Mon Sep 17 00:00:00 2001 From: dtwwwc1e <44200598+dtwwwc1e@users.noreply.github.com> Date: Wed, 17 May 2023 14:54:24 +0100 Subject: [PATCH 1/5] Initial review to help clarity --- Git_GitHub/1_Git_and_GitHub.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Git_GitHub/1_Git_and_GitHub.md b/Git_GitHub/1_Git_and_GitHub.md index 0b4e668..e8acab9 100644 --- a/Git_GitHub/1_Git_and_GitHub.md +++ b/Git_GitHub/1_Git_and_GitHub.md @@ -1,25 +1,27 @@ # Git and GitHub Git is the most widely used version control software (VCS). It is a very powerful tool to know, and we are here to learn how to get started with it. -Git and GitHub are two different tools to facilitate version control, collaboration and sharing. It's important to understand that Git is not GitHub +Git and GitHub are two different tools to facilitate version control, collaboration and sharing. It's important to understand that Git is not GitHub. Git is a software that operates locally at your machine. -A Git repository in Git, is a project in a "Folder". It contains all of the files and folders associated with your project and all the various versions of them over time. That helps to manage file changes. If you are just using Git for version control of the repository and you don't want to share your projects, you might never use GitHub. +A repository in Git is a project in a "Folder". This folder contains all of the files and folders associated with your project and all the various versions of them over time. That helps to manage file changes. If you are just using Git for version control of the repository and you don't want to share your projects, you might never use GitHub. GitHub is a service that hosts Git repositories in the cloud. Users could share a repository, and collaborate at various steps of the project. +**[DW]** all the three images below are not showing [/DW] + ![Git_GitHub](./fig/image_1.png) A repository contains all of the files and folders associated with your project. It also includes the revision history of each file. The file history is a series of snapshots in time, known as commits. A commit tells Git that you made some changes that you want to record. -When you make a commit in Git you will see “commit to main.” This refers to the default branch, which can be thought of as the production-ready version of your project. -If you want to share your repository you connect to a GitHub account. You need to create a GitHub account for that purpose. In the GitHub the repository could be accessible by multiple users. +When you make a commit in Git you will see “commit to main.” This refers to the default branch 'main', which can be thought of as the production-ready version of your project. +If you want to share your repository, you connect to a GitHub account. You need to create a GitHub account for that purpose. In GitHub the repository could be accessible by multiple users. ![Git_upload](./fig/git_checkout.png) -Your collaborators can download the GitHub repository to their local computer and work on a part of a project making a branch. Then they upload their work and request a review before is merged into the main branch. +Your collaborators can download the GitHub repository to their local computer and work on a part of a project making a branch. Then they upload their work and request a review before it is merged into the main branch. ![Git_upload](./fig/image_3.png) From 90a6935e79b9b095436a4cb993ab30cbc68158cb Mon Sep 17 00:00:00 2001 From: dtwwwc1e <44200598+dtwwwc1e@users.noreply.github.com> Date: Wed, 17 May 2023 15:31:39 +0100 Subject: [PATCH 2/5] Initial review, making changes to help clarity --- Git_GitHub/3_First_Git_Commands.md | 55 +++++++++++++++++------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/Git_GitHub/3_First_Git_Commands.md b/Git_GitHub/3_First_Git_Commands.md index 33d2366..a58d4c0 100644 --- a/Git_GitHub/3_First_Git_Commands.md +++ b/Git_GitHub/3_First_Git_Commands.md @@ -1,9 +1,13 @@ # First Git Commands +**[DW]** The episode before this is "Git and Github" which is about concept. Here, this episode moves to practical. If we provide a link to the setup instruction, it will help with the transition from concept to practical. [/DW] + You should have already completed the setup instructions for this workshop and have Git installed. Launch a command line environment (in Windows launch “Git Bash” from the Start Menu, on Linux or Mac start a new Terminal). We will use this command line interface throughout these materials, we prefer this for educational reasons because the command line is a common environment for all the operating systems. You must provide some extra information before it is ready to interact with Git. The information is related to the person who uses Git and it gives the identity of the user in any project which you might work on your computer. In collaborative projects this is used to distinguish who has made what changes. You only need to perform the above commands once for each new computer Git is installed on. +**[DW]** A little more hand holding might be useful, i.e. show a picture of Bash, and then explain the git config commands. [/DW] + ```bash git config --global user.name "FIRST_NAME LAST_NAME" # Use the name that you wish to be identified @@ -11,12 +15,11 @@ The information is related to the person who uses Git and it gives the identity ``` ## Creating a Repository - Now the Git is ready and we will use it in a new project. +Now Git is ready and we will use it in a new project. In Git terminology a project is called a repository (frequently shortened to repo). -Let's start a project withing your directories. Lets create a directory called cooking where we will store some folders and recipes. -\Users\mary\cooking +Let's start a project within your directories. Let's create a directory called 'cooking' where we will store some folders and recipes. We want 'cooking' to be immediately under our home directory, e.g. \Users\mary\cooking -Within cooking we create (with mkdir) other directories, recipes, tools, videos. We go to the directory recipes and we create pizza.md and cake.md files. There we write and instructions +Within 'cooking' we create (with `mkdir`) other directories: 'recipes', 'tools', 'videos'. We go to the directory recipes and we create files 'pizza.md' and 'cake.md' files. ```bash pwd ``` @@ -49,6 +52,9 @@ Create pizza.md and cake.md touch pizza.md cake.md ls ``` + +**[DW]** An output needing for the 'ls' command just above here. [/DW] + ## Create a Git repository To start using Git with our recipes we need to create a repository for it. Make sure the current working directory for your terminal is recipes and run: **git init** @@ -71,29 +77,31 @@ Output . .. .git cake.md pizza.md ``` We can see the hidden directory .git in the recipes directory, this signifies that it is a Git directory. -In general we can create various Git repositories within your projects, whatever happens in those folders, whatever git commands you run , whatever history is stored there are completely separated and not connected. +In general we can create various Git repositories within your projects. Whatever happens in those folders, whatever git commands you run, whatever history is stored, they are completely separated and not connected. **BEWARE** when you initialise a Git repository inside a folder all the nested folders within it are automatically in the Git repository (there is no need to initialise Git within the directory again). It is a common mistake to create Git directories in some or all the subdirectories, this complicates the process and end in error messages. The folder tree of this project should look like the picture. Only the directory recipes is a Git repo. (the Git sign is added for visualizing that we have initiated a Git repo, you will not see it at your computer) +**[DW]** Picture belog does not show up [/DW] + ![Directories_tree](./fig/repo_directories_tree.png) ## Master and main branches (You DON'T need to TYPE the COMMANDS in this section if you've done them in the set-up) - Traditionally, the default branch name in Git whenever you init a repository was master. However, the sensitivity of the online community has shifted lately and GitHub, use now main as the default name instead. + Traditionally, the default branch name in Git whenever you init a repository was master. However, the sensitivity of the online community has shifted lately and GitHub now use 'main' as the default name instead. You can read the reason in this [link](https://www.theserverside.com/feature/). **If you have done this step in the set up page and you don't need to repeat it here** -If you are using git version 2.28 or higher (you can find the version you are using with git --version) you can change the default branch name for all new repositories with: +If you are using Git version 2.28 or higher (you can find the version you are using with git --version) you can change the default branch name to 'main' for all new repositories with: ```bash git config --global init.defaultBranch main ``` -With this command the word "master" in the Git code, it is being replaced by the word "master" as the GitHub uses it. So there is an alignment for the main branch between Git and GitHub +With this command the word "master" in the Git code is replaced by the word "main" and GitHub will use it from then on. So there is an alignment for the main branch between Git and GitHub. - For existing repositories or if your git version is lower than 2.28, you can create the master branch normally and then re-name it with: +For existing repositories or if your Git version is lower than 2.28, you can create the master branch normally and then re-name it with: ```bash git branch -m master main @@ -128,11 +136,11 @@ This is a very useful command that we will use a lot. It should be your first po Don’t worry about all the output for now, the important bit is that the 2 directories and their files we already have are untracked in the repository (directory). We want to add the files to the list of files tracked by Git. Git does not track any files automatically and you need make a conscious decision to add a file. - At the next session 4_Git_Commit_Commands you will be instructed how to make changes over time and save them in tracked versions indicated by messages. + At the next session **[DW]** check session name [/DW/] 4_Git_Commit_Commands you will be instructed how to make changes over time and save them in tracked versions indicated by messages. ## Common mistake of creating multiple Git repos -As discussed above, creating Git repositories within and Git repository will cause confusion!! +As discussed above, creating Git repositories within an existing Git repository will cause confusion!! ![Warning](./fig/Warning_repo.png) @@ -158,10 +166,10 @@ Initialized empty Git repository in /Users/mary/cooking/recipes/food/.git/ (base) mary food % ls -a . .. .git curry.md pizza.md ``` -Always check with **ls -a** and you observe that amongst the files in the food directory there is a .git hidden directory that you don't want to be there as it will confuse Git. -You need to remove it using the ** rm -r** command for removing directories. +Always check with **ls -a** and you observe that amongst the files in the food directory there is a .git hidden directory that you don't want it to be there as it will confuse Git. +You need to remove it using the **rm -r** command for removing directories. -make sure you are in the food directory +Make sure you are in the food directory ```base food % rm -r .git (base) mary food % ls -a @@ -172,7 +180,7 @@ Output ``` Now there is only the parent directory (recipes) that is a Git directory and we can use Git as main branch. -Another way (which is recommended ) is to go one directory ahead (ie recipes) and we remove the .git repository at foods. ALWAYS CHECK with **pwd** +Another way (which is recommended) is to go one directory ahead (ie recipes) and we remove the .git repository at foods. ALWAYS CHECK with **pwd** ``` bash cd .. @@ -193,8 +201,8 @@ Output ```bash . .. curry.md pizza.md ``` -This is recommended when there are many nested git directories in the parent (ie recipes) -But be careful the syntax! Running this command in the wrong directory will remove the entire Git history of a project you might want to keep. Therefore, always check your current directory using the command pwd +This is recommended when there are many nested git directories in the parent (ie recipes). +But be careful the syntax! Running this command in the wrong directory will remove the entire Git history of a project you might want to keep. Therefore, always check your current directory using the command `pwd`. In this section we present: @@ -205,10 +213,11 @@ In this section we present: Key Points -Use **git config -- global** can configure a user name, email address, editor, and other preferences once per machine. +**[DW]** The first three are not covered in this episode[/DW] -**git config -h** Opens the use of the config, Opens the Git manual -**git config --help** -**git init** initializes a repository. -Git stores all of its repository data in the **.git** directory. -**rm -r .git** # Removes the git directory (rm -r ) +* Use **git config -- global** to configure a user name, email address, editor, and other preferences once per machine. +* **git config -h** Opens the use of the config, Opens the Git manual +* **git config --help** +* **git init** initializes a repository. +* Git stores all of its repository data in the **.git** directory. +* **rm -r .git** # Removes the git directory (rm -r ) From 4c4db59c64ccebdc4bc3dc65fcb617318091294c Mon Sep 17 00:00:00 2001 From: dtwwwc1e <44200598+dtwwwc1e@users.noreply.github.com> Date: Wed, 17 May 2023 15:44:39 +0100 Subject: [PATCH 3/5] Minor correction --- Git_GitHub/3_First_Git_Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Git_GitHub/3_First_Git_Commands.md b/Git_GitHub/3_First_Git_Commands.md index a58d4c0..a9f6554 100644 --- a/Git_GitHub/3_First_Git_Commands.md +++ b/Git_GitHub/3_First_Git_Commands.md @@ -1,5 +1,5 @@ # First Git Commands -**[DW]** The episode before this is "Git and Github" which is about concept. Here, this episode moves to practical. If we provide a link to the setup instruction, it will help with the transition from concept to practical. [/DW] +**[DW]** The episode before this is "Git and Github" which is about concept. Here, this episode moves to hands-on use of Git. If we provide a link to the setup instruction, it will help with the transition from concept to practical. [/DW] You should have already completed the setup instructions for this workshop and have Git installed. Launch a command line environment (in Windows launch “Git Bash” from the Start Menu, on Linux or Mac start a new Terminal). We will use this command line interface throughout these materials, we prefer this for educational reasons because the command line is a common environment for all the operating systems. From 7a70ac0fd94d2735e97ffb5a78ede4951bd50924 Mon Sep 17 00:00:00 2001 From: Mary Tziraki <61057378+mary-tziraki@users.noreply.github.com> Date: Fri, 2 Jun 2023 14:07:03 +0100 Subject: [PATCH 4/5] Answer question 1_Git_and_GitHub.md The picture is shown only in. the local machine. Do you know how to fix it to show the picture? --- Git_GitHub/1_Git_and_GitHub.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Git_GitHub/1_Git_and_GitHub.md b/Git_GitHub/1_Git_and_GitHub.md index e8acab9..44d6622 100644 --- a/Git_GitHub/1_Git_and_GitHub.md +++ b/Git_GitHub/1_Git_and_GitHub.md @@ -9,6 +9,7 @@ A repository in Git is a project in a "Folder". This folder contains all of the GitHub is a service that hosts Git repositories in the cloud. Users could share a repository, and collaborate at various steps of the project. **[DW]** all the three images below are not showing [/DW] +**[MT]** I know it only shows up in the local machine. do you know how to fix it? [/MT] ![Git_GitHub](./fig/image_1.png) From d3caa8597b0e181d8f0ca4b8b70e112693be2e6f Mon Sep 17 00:00:00 2001 From: Mary Tziraki <61057378+mary-tziraki@users.noreply.github.com> Date: Fri, 2 Jun 2023 14:29:02 +0100 Subject: [PATCH 5/5] Answered David questions Update 3_First_Git_Commands.md I've created a presentation where videos are embedded. I don't know why the pictures doest appear in GitHub --- Git_GitHub/3_First_Git_Commands.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Git_GitHub/3_First_Git_Commands.md b/Git_GitHub/3_First_Git_Commands.md index a9f6554..1e4bdb7 100644 --- a/Git_GitHub/3_First_Git_Commands.md +++ b/Git_GitHub/3_First_Git_Commands.md @@ -1,12 +1,14 @@ # First Git Commands **[DW]** The episode before this is "Git and Github" which is about concept. Here, this episode moves to hands-on use of Git. If we provide a link to the setup instruction, it will help with the transition from concept to practical. [/DW] +**[MT]** I would move it to the 1_Git-and_GitHub and name it 1_Git-and_GitHub_firts_commands. [/MT] -You should have already completed the setup instructions for this workshop and have Git installed. Launch a command line environment (in Windows launch “Git Bash” from the Start Menu, on Linux or Mac start a new Terminal). We will use this command line interface throughout these materials, we prefer this for educational reasons because the command line is a common environment for all the operating systems. +You should have already completed the setup instructions for this workshop and have it installed. You might have launched a command line environment (in Windows launch “Git Bash” from the Start Menu, on Linux or Mac start a new Terminal). We will use this command line interface throughout these materials, we prefer this for educational reasons because the command line is a common environment for all the operating systems. -You must provide some extra information before it is ready to interact with Git. -The information is related to the person who uses Git and it gives the identity of the user in any project which you might work on your computer. In collaborative projects this is used to distinguish who has made what changes. You only need to perform the above commands once for each new computer Git is installed on. +You must provide some extra information before it is ready to interact with git. +The information is related to the person who uses git and it gives the identity of the user in any project which you might work on your computer. In collaborative projects this is used to distinguish who has made what changes. You only need to perform the above commands once for each new computer Git is installed on. **[DW]** A little more hand holding might be useful, i.e. show a picture of Bash, and then explain the git config commands. [/DW] +**[MT]** OK I'll creare screen shots for eveything. I have created a presentation and it has short videos in it. That's why I havent got the images here. ```bash git config --global user.name "FIRST_NAME LAST_NAME" # Use the name that you wish to be identified