Zulip Chat Archive
Stream: mathlib4
Topic: Synching Branch
David Ledvinka (Apr 13 2025 at 20:18):
If you are working on branch of mathlib (in particular one that is in an ongoing PR) whats the correct way to "update" the branch with the changes to master?
Etienne Marion (Apr 13 2025 at 20:22):
merge origin/master
I think? At least that’s what I do.
Yaël Dillies (Apr 13 2025 at 20:22):
git fetch; git merge origin/master
(on your branch) is the beginner-friendly option. More advanced options are git fetch; git rebase origin/master
and similar (but I would advise you against them for now)
Etienne Marion (Apr 13 2025 at 20:23):
Oh I forgot git
:sweat_smile: I have never understood what git fetch
does though
Yaël Dillies (Apr 13 2025 at 20:24):
It simply instructs git to update its local knowledge of the remote
Etienne Marion (Apr 13 2025 at 20:27):
I see. I thought that merging an origin branch would automatically pick up the most recent version available online
Yaël Dillies (Apr 13 2025 at 20:28):
No, it merely picks up what your local git thinks origin/master
is. It just happens that vscode comes with the good default option of running git fetch
every five minutes or something like that
Etienne Marion (Apr 13 2025 at 20:29):
Oh I see, thanks!
Junyan Xu (Apr 14 2025 at 00:56):
It just happens that vscode comes with the good default option of running
git fetch
every five minutes or something like that
Doesn't appear so for me ... I always manually fetch before merging master, otherwise it could be days or months old ...
okay I found these settings
Yury G. Kudryashov (Apr 14 2025 at 01:26):
You can git pull from master instead of git merge
Junyan Xu (Apr 14 2025 at 01:32):
Seems I need git pull origin master --no-ff
if there is a conflict, but indeed a shorter single command is nice!
Yury G. Kudryashov (Apr 14 2025 at 04:13):
Your editor probably has a plugin that hides all these commands behind a nice UI.
Yury G. Kudryashov (Apr 14 2025 at 04:13):
I know that VS Code and Emacs have git extensions. I guess, nvim has one too.
Last updated: May 02 2025 at 03:31 UTC