Skip to content

Commit 72aa3d9

Browse files
committed
init: Create Version Control Notes Project
0 parents  commit 72aa3d9

File tree

61 files changed

+649
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+649
-0
lines changed

.gitignore

Whitespace-only changes.

01-What-is-Version-Control.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
# What is version Control
4+
5+
## The Past
6+
7+
8+
## The Present
9+
10+
11+
## Types of Version Control System
12+
13+
14+
15+
## Distributed Version Control
16+
17+

02-getting-ready.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Before you start (Required Software)
2+
3+
You will need to ensure one of the following combinations is installed:
4+
- Microsoft Terminal and Git-SCM, or
5+
- Microsoft Terminal and Laragon
6+
7+
## Microsoft Terminal Installation
8+
9+
This is a great way to interact with the command line.
10+
11+
Open the Microsoft Store, and search for "Microsoft Terminal".
12+
13+
Install the "Microsoft Terminal" version and not the preview.
14+
15+
## Git Installation
16+
17+
Easiest way is to download and use the Git SCM installer:
18+
19+
https://git-scm.com/download/win
20+
21+
Use the 64 Bit version when possible.
22+
23+
Run the installer and accept the defaults.
24+
25+
## Laragon Installation
26+
27+
Download the Full Installer from https://laragon.org/download/index.html.
28+
29+
Run the installer and accept the defaults.
30+
31+
This places Laragon in the folder `c:\Laragon`.
32+
33+
# The CLI
34+
35+
CLI stands for Command Line Interpreter.
36+
37+
There are many of them including:
38+
- Windows Command Prompt
39+
- Microsoft PowerShell
40+
- bash
41+
- zshell
42+
- and many more
43+
44+
## Parts of the Prompt
45+
46+
| Image | Description |
47+
| ---- | ---- |
48+
| ![[Pasted image 20240216111739.png]] | This is the user account, followed by the computer name and separated by an `@`<br><br>Literally: *User **at** Computer*<br> |
49+
| ![[Pasted image 20240216111840.png]] | Tells us that we are running in MinGW 64 bit<br> |
50+
| ![[Pasted image 20240216111909.png]] | Shows we are in the `~/Source/Repos` folder, where `~` is the user's (your) home folder.<br><br>In Windows terms, this is the same as:<br><br> `C:\Users\UserName\Source\Repos`<br> |
51+
52+
## Setting up Microsoft Terminal to use Git Bash as a CLI
53+
54+
Open MS Terminal.
55+
56+
Click on the `v` (or press `CTRL`+`,`) on the tab bar.
57+
58+
Click *Settings*...
59+
60+
![[Pasted image 20240216103325.png]]
61+
62+
Click on *Add a new profile*...
63+
64+
![[Pasted image 20240216103615.png]]
65+
66+
Click *New Empty Profile*...
67+
68+
![[Pasted image 20240216103644.png]]
69+
70+
Click on the `v` next to the "*Profile x*"...
71+
72+
![[Pasted image 20240216103947.png]]
73+
74+
And give the profile a name...
75+
76+
![[Pasted image 20240216103833.png]]
77+
78+
Next find the *Command Line* entry and click on the `v`
79+
80+
![[Pasted image 20240216104034.png]]
81+
82+
Then click the *Browse* button...
83+
84+
![[Pasted image 20240216104105.png]]
85+
86+
At home, if you have installed using Git-SCM installer then the default location for Git is: `c:\program files\git`. If you have Laragon installed using the default installation location, then you should find Git in the `C:\Laragon\bin\git` folder.
87+
88+
> At TAFE, we have a different location, `c:\ProgramData\git` or even `C:\ProgramData\Laragon\bin\git`.
89+
90+
Use the browse to locate the folder and find either the `git.exe` or the `bash.exe` file in the `bin` folder.
91+
92+
![[Pasted image 20240216105026.png]]
93+
94+
Click on the Starting Directory `v` and then untick the "*Use parent process directory*"...
95+
96+
![[Pasted image 20240216105847.png]]
97+
This should then show `%USERPROFILE%` in a text field and `Browse` button underneath...
98+
99+
![[Pasted image 20240216105903.png]]
100+
101+
No matter what is shown, clear the content and enter the following in its place...
102+
103+
`%USERPROFILE%\Source\Repos`
104+
105+
![[Pasted image 20240216110033.png]]
106+
107+
Click `SAVE` to save the changes
108+
109+
### Visual flair (optional)
110+
You may optionally customise the appearance of the terminal.
111+
112+
Adrian tends to do this to visually identify the various prompts.
113+
114+
The steps below are optional, and you may vary to your own "taste".
115+
116+
Click the *Appearance* item.
117+
118+
![[Pasted image 20240216110837.png]]
119+
120+
You may change the base colour scheme, the font face and more.
121+
122+
Here are the settings Adrian has for this terminal prompt:
123+
124+
![[Pasted image 20240216110957.png]]
125+
126+
Click Save then you can click the `X` next to settings to close the dialog.
127+
![[Pasted image 20240216111033.png]]
128+
129+
Finally you are able to open the new terminal by clicking on the `v` and selecting your custom terminal or using the short-cut it shows on the right next to your custom terminal.
130+
131+
![[Pasted image 20240216111111.png]]
132+
133+
You will now have your terminal open and ready:
134+
135+
![[Pasted image 20240216111239.png]]

03-repositories-and-folders.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Repositories and Folders
2+
3+
Projects are contained in a folder in your user's root/home folder.
4+
5+
This folder is the `Source/Repos` folder.
6+
7+
If you do not have this folder then the steps below should be followed.
8+
9+
## Creating a `Source/Repos` folder structure for projects
10+
11+
Open Terminal and then click the `v` next to the `+` on the tab bar.
12+
13+
Select the *Command Prompt* option
14+
15+
![[Pasted image 20240216105215.png]]
16+
17+
When the terminal opens use the following commands to change into your "user home" and make the `Source\Repos` folder.
18+
19+
> **Important:** We tend to use the forward slash `/` in notes as they show up easily, plus most operating systems other than Windows use the `/` as the folder separator.
20+
>
21+
> Later you will see this in action when using the Git command line.
22+
23+
Here are the commands to use:
24+
```shell
25+
cd %userprofile%
26+
mkdir Source
27+
mkdir Source\Repos
28+
```
29+
You should now have the folders created.
30+
31+
Check this using:
32+
```shell
33+
dir Source\Repos
34+
```
35+
It should show a folder listing with no files.

04-git-started.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Git Started
2+
3+
We are now ready to get started, and create a repository and work with it.
4+
5+
## Initialising a Repository for a 'project'
6+
7+
There are three main ways to start a project. Two of them presume you have no existing files to begin with, and the third when you have files in an existing folder.
8+
9+
### Option 1: Create a folder then initialising
10+
11+
Use `mkdir` command to create the folder, change into the new folder, and then using the `git init .` command.
12+
13+
Let's presume the new project will be in the `Duck-Rogers` folder.
14+
15+
Use the `pwd` command to verify the folder:
16+
![[Pasted image 20240216113101.png]]
17+
18+
You see that the Windows `\` have been reversed to `/` and the `:` removed.
19+
20+
```shell
21+
mkdir Duck-Rogers
22+
cd Duck-Rogers
23+
git init .
24+
```
25+
26+
![[Pasted image 20240216113320.png]]
27+
28+
The command prompt will now show either `(master)` or `(main)` - if it is `master`, we will show you later how to (a) change it to `main` for the current project and (b) to make `main` the default.
29+
30+
### Option 2: Initialise project and folder at same time
31+
32+
To create the `Duck-Rogers` folder and initialise in a single move, we do the following:
33+
34+
```
35+
git init Duck-Rogers
36+
cd Duck-Rogers
37+
```
38+
39+
![[Pasted image 20240216113649.png]]
40+
41+
![[Pasted image 20240216113804.png]]
42+
43+
### Option 3: Initialise project with existing files
44+
45+
The best part of this is that you are basically able to use the previous options, except the folder already exists.
46+
47+
For example, if `Duck-Rogers` already exist and has files, then, if we are at the parent folder for Duck-Rogers we can use the `git init Duck-Rogers` command.
48+
49+
![[Pasted image 20240216114404.png]]
50+
51+
If you are in the `Duck-Rogers` folder and there are files in the folder then using the `git init .` command will do the same thing.
52+
53+
![[Pasted image 20240216114456.png]]
54+
55+
56+
## Verify Repository was Created
57+
58+
To check it is created we use the `ls -la` command:
59+
60+
![[Pasted image 20240216113831.png]]
61+
62+
Notice the last line. The `d` at the start tells you it is a folder (directory), and its name is `.git`. It is a hidden folder.
63+
64+
All tracking of changes are then stored in the `.git` folder. If you delete this folder, you delete the whole history of your project.

05-global-settings.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
## Global configuration changes
2+
3+
Git, like any software has many things that can be changed. These area stored in a global configuration file, in a project only configuration file.
4+
5+
Most of the configuration options are able to be set for both, but we show the global (for you as the user) changes you may want to make.
6+
7+
### Git User Name and Email Address
8+
9+
To change the username and email address being stored as part of the commit sequence, we use the following two commands:
10+
11+
```bash
12+
git config --global user.name "YOUR NAME"
13+
git config --global user.email "YOUR EMAIL ADDRESS"
14+
```
15+
16+
The `--global` indicates that the changes are stored for this and all future projects.
17+
18+
![[Pasted image 20240216124422.png]]
19+
20+
To see the global settings...
21+
```shell
22+
git config --list --global
23+
```
24+
25+
![[Pasted image 20240216124543.png]]
26+
27+
### Per Project Configuration
28+
29+
These need to be repeated for any project that is not going to be listed under your 'global' config.
30+
31+
Make sure you are in the project you wish to use project only configured settings.
32+
33+
Then set your required configuration by using:
34+
35+
```shell
36+
git config SETTING VALUE
37+
```
38+
39+
For example, changing the "user" and "email" to be your TAFE details rather than using your personal email and name...
40+
41+
Lets say your ID is `00000000` and email is `[email protected]` we could use:
42+
43+
```bash
44+
git config user.name "00000000"
45+
git config user.email "[email protected]"
46+
```
47+
48+
The `--global` indicates that the changes are stored for this and all future projects.
49+
50+
![[Pasted image 20240216124422.png]]
51+
52+
53+
### Default "Branch" name to Main...
54+
55+
To do this for ALL FUTURE projects we use:
56+
57+
```bash
58+
git config --global init.defaultBranch main
59+
```
60+
### Change Current Project's Branch Name
61+
62+
To change the current 'master branch' to be the 'main branch' we need to do the following *AFTER* a commit is completed:
63+
```bash
64+
git branch -m master main
65+
```
66+
67+
![[Pasted image 20240216125018.png]]
68+
69+
70+
71+
72+
73+
74+
### Default Commit Message Editor
75+
76+
It is possible to change the code editor for commit messages to something like Notepad.
77+
78+
Below we change the editor to "nano" - a extremely small footprint terminal text editor on MacOS and Linux.
79+
80+
```shell
81+
git config --global core.editor "nano"
82+
```
83+
84+
To change it to Notepad we would use:
85+
86+
```shell
87+
git config --global core.editor "notepad"
88+
```
89+
90+
> **Important:** when using a GUI editor such as Notepad, you **MUST** **SAVE** and **CLOSE** the message, then (usually optionally) **QUIT** the application for the message to be transferred to the git command.
91+
92+
Now when you enter `git commit` the Notepad editor will open. The command line will tell you it is waiting for the editor to close a file (`COMMIT_MESSAGE`).
93+
94+
![[Pasted image 20240223102507.png]]
95+
96+
When Notepad is opened, it will show a set of comments that tell you details about the added files as comments.
97+
98+
![[Pasted image 20240223102034.png]]
99+
100+
Now editing the commit message and adding the details that may be more than just a one liner is easy.
101+
102+
You then enter the SHORT commit message and, as required, a blank line followed by more details about the changes that have been made to the project.
103+
104+
For example:
105+
106+
```text
107+
feat(readme): Add demo commit demo of external editor
108+
109+
- Change config for default commit editor to Notepad
110+
- Add a single blank line to the ReadMe for demo purposes
111+
- Add ReadMe to staging
112+
- Run git commit
113+
- Demonstrate the long form of commit message
114+
- Save (`CTRL`+`S`) and close (`CTRL`+`F4`) the message
115+
- Optionally, quit the editor (`ALT`+`F4`)
116+
```
117+
118+
119+
120+
> **Warning:** Tests have indicated that you will not be able to use 'VSCode' as the editor for messages.
121+
>
122+
> On execution the editor does not negotiate correctly with the command line and git aborts the commit.
123+

06-read-me.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Creating a `ReadMe.md` for the project
2+
3+
The Bash/git shell has the ability to create a empty file really easily.
4+
5+
For example an empty `ReadMe.md` file would be created using:
6+
7+
```shell
8+
touch ReadMe.md
9+
```
10+
11+
In the Windows Command Prompt we need to use:
12+
13+
```shell
14+
copy nul > ReadMe.md
15+
```
16+
17+
The `>` tells the command to write to a file with the name of the file after the `>`.
18+
19+
If you used `>>` it would append the output of the command to the file named after the `>>`.

07-ignore-me.md

Whitespace-only changes.

0 commit comments

Comments
 (0)