Menu
Coddy logo textTech

Remotes

Synchronisiere dein lokales Repository mit einem Remote wie GitHub - push, pull, fetch.

Syncing with a remote repository

Your local repository and the one on GitHub are separate, full copies - nothing moves between them until you say so. git push uploads your commits, git fetch downloads what is new without touching your work, and git pull is fetch plus merge in one step. Once a branch has an upstream set (git push -u), all three run without arguments.

The sharp edge in this category is force-pushing: after a rebase your history no longer matches the remote, and only git push --force (or the safer --force-with-lease) will be accepted. The pages here cover when that is legitimate and how to do it without overwriting a teammate’s work.

Häufig gestellte Fragen

What is the difference between git fetch and git pull?
git fetch downloads new commits from the remote but leaves your branch untouched - you look first, integrate later. git pull does the fetch and immediately merges (or rebases, with --rebase) the changes into your current branch.
How do I push a new local branch to GitHub?
git push -u origin branch-name. The -u flag sets the remote branch as the upstream, so from then on plain git push and git pull on that branch know where to go.
When is it safe to force push?
Only on branches you own - typically your feature branch after a rebase. Prefer git push --force-with-lease: it refuses to overwrite the remote if someone else pushed since you last fetched, which plain --force would silently destroy.