• body_by_make@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      22
      ·
      edit-2
      9 months ago

      You can default git to using your current branch and a specific upstream so you don’t have to put anything after git push

        • bleistift2@feddit.de
          link
          fedilink
          English
          arrow-up
          7
          arrow-down
          1
          ·
          9 months ago

          Has git never told you that you should use git push -u origin <branch> when you push a new branch for the first time?

    • PoolloverNathan@programming.dev
      link
      fedilink
      arrow-up
      16
      ·
      9 months ago

      The first time you manually push like that, you can add the -u flag (git push -u origin master) to push and set the branch’s default upstream. Afterwards, a plain git push while that branch is checked out will push the branch to that default upstream. This is per-branch, so you can have a main branch that pulls from one repository and a patch branch that pulls and pushes to a different repository.

      • blind3rdeye@lemm.ee
        link
        fedilink
        arrow-up
        6
        ·
        9 months ago

        My strategy is to just type git push and get some kind of error message about upstream not being set or something. That’s a signal for me to take a second to think about what I’m actually doing and type the correct command.

        • embed_me@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          9 months ago

          That’s a signal for me to

          … google the error and randomly try stack overflow answers without really understanding them.

          ( I have changed)