Login
You're viewing the ruby.social public feed.
  • Apr 14, 2026, 7:37 AM

    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

    💬 1🔄 1⭐ 1

Replies

  • Apr 14, 2026, 7:38 AM

    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.

    💬 0🔄 0⭐ 0