Key Points

Navigating the filesystem


  • Knowing where you are in your directory structure is key to working with the shell
  • pwd shows where you are, ls lists the contents of a directory and cd moves you to another directory
  • ls -a also shows hidden files and directories, whose names start with a dot
  • man or --help show the options of a command

Working with files and directories


  • mkdir creates a directory and touch creates an empty file
  • echo "text" > file writes text into a file, >> adds it at the end
  • cat, head, tail and less show the content of files
  • mv moves or renames, cp copies and rm deletes files – there is no undo for rm
  • Tab completion, the up arrow key and wildcards (*, ?) save a lot of typing

What is Git/Codeberg?


  • Version control helps track changes to files and projects
  • Git and Git hosting platforms like Codeberg are not the same

Getting started with Git


  • When you initialize a Git repository in a directory, Git starts tracking the changes you make inside that directory.
  • This tracking creates a history of the way the files have changed over time.
  • Git uses a two-step process to record changes to your files. Changes to files must first be added to the staging area, then committed to the Git repository.

Sharing your work


  • remote repositories on Codeberg help you collaborate and share your work
  • push is a Git verb for sending changes from the local repository to a remote repository
  • pull is a Git verb for bringing changes from a remote repository to the local repository
  • diff is a Git verb for viewing the difference between an edited file and the file’s most recent commit

Review


  • the language of Git can be confusing and intimidating
  • rephrasing commands and drawing concepts can clarify Git’s workflow

Managing a project with issues


  • Issues are used to report problems, ask questions and plan tasks in a repository
  • Anybody with a Codeberg account can open issues in a public repository
  • Labels, assignees and milestones help to organise issues
  • Project boards give an overview of the state of issues
  • Commits, issues (#1) and people (@username) can be referenced in issues and comments
  • Closed issues remain as a searchable record of the project

Contributing with pull requests


  • A pull request (on GitLab: merge request) suggests changes from one branch to another, often from a fork to the original repository
  • Work on a new branch for each contribution
  • Closes #<number> in a pull request description closes the issue when the pull request is merged
  • Reviewers can comment on individual lines and approve or request changes
  • New commits on the branch update the pull request