Remotes represent the URLs of Git repositories, e.g. origin
.
Make sure you have the main repository as a remote:
$ git remote -v
origin [email protected]:curquiza/MeiliSearch.git (fetch)
origin [email protected]:curquiza/MeiliSearch.git (push)
If not, add the main repository as a new remote:
$ git remote add upstream [email protected]:meilisearch/MeiliSearch.git
$ git remote -v
origin [email protected]:curquiza/MeiliSearch.git (fetch)
origin [email protected]:curquiza/MeiliSearch.git (push)
upstream [email protected]:meilisearch/MeiliSearch.git (fetch)
upstream [email protected]:meilisearch/MeiliSearch.git (push)
MeiliSearch
repository: don't forget to replace MeiliSearch
by the repository name on what you are working!
The goal of the rebase is to move your commits (from your branch) to be placed right after the last commit on main
, keeping the Git history clear. See this documentation for more details about the rebase.
Make sure you are on main
and your local commits on main
are up-to-date with the upstream ones:
$ git checkout main
$ git pull upstream main
Go back to your branch and rebase:
$ git checkout your-branch-name
$ git pull origin your-branch-name # In case you accepted commit suggestions on the GitHub interface
$ git rebase main
You might have some merge conflicts. Fix them (git status
could help you about what to do).
Merge conflicts or not, you finally have to do:
$ git push --force origin your-branch