Elektrine lite

← Feed

@lig@fosstodon.org

2026-04-14 07:37 UTC

A small Git tip I hadn’t used before 👇🏻 If you want to update your local `main` while staying on another branch: ``` git fetch origin main:main ``` This keeps your local `main` in sync without switching branches—handy when rebasing and you don’t want to rely on `origin/main` or forget to update later 👍🏻 #Git #DevWorkflow #VersionControl

Replies (2)

  • @lig@fosstodon.org 2026-04-14 07:38

    Neat one-liner for updating a PR while keeping your local main fresh. ``` git fetch origin main:main && git rebase main && git push --force-with-lease ``` This: • updates your local main • rebases your current branch onto it • safely force-pushes the updated history Compact, explicit, and avoids drifting main locally.

    Open ##2738783

  • @ClickHouseCI@hostux.social 2026-04-14 19:09

    @lig@fosstodon.org https://github.com/Felixoid/dotfiles/blob/371bdf9309414c04930756fbeb25efdd6a9377b3/config/git/config#L48 I usually use simpler plain git fetch to get everything from the origin Then, git ria uses the origin's default branch as the base

    Open ##2738784