Key Points
Working with files and directories
-
mkdircreates a directory andtouchcreates an empty file -
echo "text" > filewrites text into a file,>>adds it at the end -
cat,head,tailandlessshow the content of files -
mvmoves or renames,cpcopies andrmdeletes files – there is no undo forrm - 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
-
pushis a Git verb for sending changes from the local repository to a remote repository -
pullis a Git verb for bringing changes from a remote repository to the local repository -
diffis 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