Git

Cheatsheet

Base commands

To add changed files to staging

git add <filename>

To check the status of files that have been added to staging

git status

To push changes to a remote repository

git push

Merging

Update a fork with changes from the upstream repository

git remote add upstream https://codeberg.org/whoever/whatever.git
git fetch upstream
git checkout main
git rebase upstream/main

Merge two local repositories

cd path/to/project-a
git checkout some-branch

cd path/to/project-b
git remote add project-a /path/to/project-a
git fetch project-a --tags
git merge --allow-unrelated-histories project-a/some-branch
git remote remove project-a