Branching and teamwork



“Git makes it easy to switch between branches and handle conflicts when merging.
With branches, you can work independently and keep your code organized.”1
git branch --list lists all of your branches. * Indicates your current branch
git branch -l for short
git branch if you feel especially lazy/cool 😎git branch new-branch-name creates a new branch with the name new-branch-namegit switch new-branch-name switches to branch named new-branch-name
git switch -c new-branch-name creates a new branch with name new-branch-name AND switches to itgit checkout new-branch-name does the same (switch is less ambiguous, checkout also has other uses)
git checkout -b new-branch-name same as git switch -c new-branch-name☞ Note: you cannot switch branches before making at least one commit on your current branch!
git branch -d branch-namegit branch -l (or git branch --list in full)
git reset for this
git merge branch-namegit merge branch-namegit commit!<<<<<<< HEAD |
your current branch’s version |
======= |
marks where the version from the other branch starts |
>>>>>>> new-feature |
is the end of the version from the other branch (new-feature will be the name of your specific branch) |

Non-profit (in EU)
Privately owned (in US)
Open source
☞ Note: only self-hosted GitLab is Open Source!

Follow these steps
It is not required, but it makes life easier. And safer.
git clone ssh://git@codeberg.org/UsernameOrOrganisation/repo-name

git remote -v to check the URLgit pull pulls the latest changes from remote repo and merges them into local branchgit push -u origin branchname uploads local commits explicitly to remote repo branch of name ‘branchname’
git push is shorter and uses your repo’s defaults.
git reset, git stash, etc.)git pull)git switch -c new-branch-namegit push -u origin new-branch-name)

☞ Note: make sure you pull the branch you merged into locally before continuing with new changes. Also clean up any branches you are done with.
The steps below indicate steps for different group members. Do try to follow these steps together: one person does the step, the other(s) watch and comment.
Radboud.md file (more trivia! More nonsense!)