Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

GitHub

Updated: 28 jan 2026

Basics

Push and pull

CommandDescription
git checkout mainSwitch to the main branch.
git pullFetch and merge changes from the remote repository to your local repository.
git add <file_name>Stage changes for the next commit.
git add .Stage ALL changes in the current directory for the next commit.
git commit -m "commit message"Commit staged changes with a descriptive message.
git pushUpload local repository content to a remote repository on GitHub.
git fetch originDownload objects and refs from another repository.

Cloning and branching

CommandDescription
git clone <repo_url>Clone a repository from GitHub to your local machine.
git branchLists branches in your repository.
git checkout <branch_name>Switch to a different branch in your repository.
git switch -C <branch_name>Create and switch to a new branch.

Solve conflicts

CommandDescription
git revert <commit_hash>Revert changes made in a specific commit by creating a new commit.
git reset --hard <commit_hash>Reset your branch to a specific commit, discarding all changes after that commit.
git reset --hard HEADReset your branch to the last commit, discarding all changes after that commit.

Synch with remote repo

CommandDescription
git fetch originDownload objects and refs from another repository.
git reset --hard origin/mainReset your branch to match the remote main branch, discarding all local changes.
git clean -fdRemove untracked files and directories from the working directory.

Replace to another branch

CommandDescription
git switch -c nieuwe_branchCreate and switch to a new branch named “nieuwe_branch”.
git add .Stage all changes in the current directory for the next commit.
git commit -m "Mijn edits"Commit staged changes with the message “Mijn edits”.

Merging branches

CommandDescription
git merge <branch_name>Merge a specified branch into the current branch.
git merge --squash <branch_name>Combine all changes from a specified branch into a single commit on the current branch.

Remove branch

CommandDescription
git branch -d <branch_name>Delete a local branch.
git push origin --delete <branch_name>Delete a remote branch on GitHub