Skip to content

5. Monologue

Smiley with a bowtie A monologue is when you talk to someone without letting them talk back
Smiley with sunglasses Monologues are my favorite!

In this chapter, we are going to use the basic git workflow by writing a monologue.

5.1 Have a Codeberg repository

Your new Codeberg repository

In this chapter, we will use an example user, which is richelbilderbeek and and example repository name, which is iloverichel.

Smiley with a bowtie A repository is a website that works with git

5.2 Exercise 1

Create a Codeberg page for your repository.

Smiley 'repository' is often shortened to 'repo'

5.3 Cloning a repository

To clone your repository, in Git Bash, or a Linux/Mac terminal, do:

git clone https://codeberg.org/richelbilderbeek/iloverichel.git

Before cloning your repository

This will download your online repository to a folder on your harddrive:

After cloning your repository

5.4 Exercise 2

Clone your repository.

Smiley with sunglasses Star Wars 'The Clone Wars' was not about git

5.5 Navigate into the folder

After cloning a repo, we need to navigate into the folder where the repository is. Use cd and the repository name (in this example iloverichel):

cd iloverichel

Navigate into the folder

Smiley with a bowtie cd means 'Change directory'

To make sure you are in that folder, use ls:

ls

List the files in your folder

Smiley with a bowtie ls means 'List'

One file you will see is called README.md.

5.6 Exercise 3

Navigate into the folder where your repo is cloned.

Smiley with a bowtie Use cd to change the directory/folder

5.7 Use git status

git status is very helpful. You can always use git status in a repo folder:

git status

git status gives many hints how to use git.

5.8 Exercise 4

Run git status in a repo folder. If you get an error message, you did not navigate into a repo folder.

Smiley with sunglasses My git status is Cool

5.9 Edit README.md

README.md contains the front page of your GitHub repo.

Smiley with a bowtie README.md is in screamcase, due to history
Smiley .md is short for 'Markdown', which is a markup language
Smiley with sunglasses HTML is a famous markup language

To edit README.md, you can open it:

  • using a file browser (e.g. Microsoft File Manager, Apple Files, or Nautulus)
  • using Git Bash or a terminal

In Git Bash or the terminal, do:

[name of your editor] README.md

where [name of your editor] is the name of your editor, for example notepad, mousepad, edit, gedit, vim, emacs.

Smiley There are many text editors!

This is, for example:

notepad README.md

Now your editor will open up and you can modify the README.md file.

Editing the README.md file

The text will be similar to:

# iloverichel

Change the text in any way, as if having a monologue:

# iloverichel

Richel was here!

The README.md file has been edited

Save the file and close the editor.

You will be taken back to Git Bash or terminal:

Back to the command line

5.10 Exercise 5

Edit your README.md.

5.11 add, commit, push

Now come the most commonly used three git commands.

Smiley git can do a lot of things

Tell git you want to 'stage' (whatever that is) all files you've changed:

git add .

Don't forget the dot (.) at the end!

Next, tell git what your changes were:

git commit -m "Improved monologue"

Between the "s you describe what you did.

Smiley with a bowtie Good programmers have commit messages that tells clearly what they did

Finally, upload your work to Codeberg:

git push

If you did it correctly, your Codeberg repository will have your new text.

If you are asked for:

  • a password, type it in
  • another password, type it in again
  • an access token, see chapter 'Register and login'
Smiley git needs to be sure who you are

After this, do another round of add, commit, push :-)

Congratulations, you just did the full workflow!

5.11 Exercise 6

A repo with many commits

Add 5 commits by, for 5 times, adding a sentence and then add, commit, push.

Tip: with the arrow key upwards, you can get back previous commands!

Smiley with sunglasses It is handy that Git Bash knows my previous commands!