# Making it possible to do “git push origin” instead of “git push origin <branch>”, without having to one-time prepare each branch for it

5 messages from 2016-12-22 to 2016-12-27. Participants: Stefan Monov, Junio C Hamano, Jacob Keller.
Thread: https://gitlist.dev/t/44757

## Stefan Monov, 2016-12-22 21:14

Subject: Making it possible to do “git push origin” instead of “git push origin <branch>”, without having to one-time prepare each branch for it
Message-ID: <CAJtFkWtjowyGaFfsCVd-HAZM2-3e0=CkkyYfxne8KRdYq5kJ9g@mail.gmail.com>
URL: https://gitlist.dev/e/CAJtFkWtjowyGaFfsCVd-HAZM2-3e0%3DCkkyYfxne8KRdYq5kJ9g%40mail.gmail.com

```
Hi.

I'd like to use just:

    git push

or at most:

    git push origin

rather than having to first check which is the active branch with `git
branch --list`, then type:

    git push origin <branch>

At [1] and [2] I've seen that if I do this once:

    git push -u origin <branch>

then from then on I can use just `git push` _for that branch_.
However, I don't want to do this "setup" step for each branch, because
it's extra work that I also may forget to do.

Why is this "setup" step necessary and can I avoid it?

Thanks,
Stefan

[1] http://stackoverflow.com/q/19312622
[2] http://stackoverflow.com/q/6529136

```

## Stefan Monov, 2016-12-22 21:18

Subject: Re: Making it possible to do “git push origin” instead of “git push origin <branch>”, without having to one-time prepare each branch for it
Message-ID: <CAJtFkWuypdH+ikdXL=-DXOx-8F+34nV3phqO2jTGoqtnM7=DZA@mail.gmail.com>
URL: https://gitlist.dev/e/CAJtFkWuypdH%2BikdXL%3D-DXOx-8F%2B34nV3phqO2jTGoqtnM7%3DDZA%40mail.gmail.com
In-Reply-To: <CAJtFkWtjowyGaFfsCVd-HAZM2-3e0=CkkyYfxne8KRdYq5kJ9g@mail.gmail.com>

```
Also, if I do the "setup" step (`push -u`) for a branch that doesn't
exist yet (neither on my PC nor on the server), does that remove the
need to do `git checkout -b <branch>` first?

On Thu, Dec 22, 2016 at 11:14 PM, Stefan Monov <logixoul@gmail.com> wrote:
> Hi.
>
> I'd like to use just:
>
>     git push
>
> or at most:
>
>     git push origin
>
> rather than having to first check which is the active branch with `git
> branch --list`, then type:
>
>     git push origin <branch>
>
> At [1] and [2] I've seen that if I do this once:
>
>     git push -u origin <branch>
>
> then from then on I can use just `git push` _for that branch_.
> However, I don't want to do this "setup" step for each branch, because
> it's extra work that I also may forget to do.
>
> Why is this "setup" step necessary and can I avoid it?
>
> Thanks,
> Stefan
>
> [1] http://stackoverflow.com/q/19312622
> [2] http://stackoverflow.com/q/6529136

```

## Junio C Hamano, 2016-12-22 21:41

Subject: Re: Making it possible to do “git push origin” instead of “git push origin <branch>”, without having to one-time prepare each branch for it
Message-ID: <xmqq7f6rfxpe.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq7f6rfxpe.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CAJtFkWtjowyGaFfsCVd-HAZM2-3e0=CkkyYfxne8KRdYq5kJ9g@mail.gmail.com>

```
Stefan Monov <logixoul@gmail.com> writes:

> I'd like to use just:
>
>     git push
>
> or at most:
>
>     git push origin
>
> rather than having to first check which is the active branch with `git
> branch --list`, then type:
>
>     git push origin <branch>

Perhaps you are a target audience of

    $ git config push.default current

then?

```

## Jacob Keller, 2016-12-22 21:46

Subject: Re: Making it possible to do “git push origin” instead of “git push origin <branch>”, without having to one-time prepare each branch for it
Message-ID: <CA+P7+xpdKEoNY_cgY4g3bMVZe0p-2bYT4Y-3nYyd0O03iD1nZg@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2BP7%2BxpdKEoNY_cgY4g3bMVZe0p-2bYT4Y-3nYyd0O03iD1nZg%40mail.gmail.com
In-Reply-To: <CAJtFkWtjowyGaFfsCVd-HAZM2-3e0=CkkyYfxne8KRdYq5kJ9g@mail.gmail.com>

```
On Thu, Dec 22, 2016 at 1:14 PM, Stefan Monov <logixoul@gmail.com> wrote:
> Hi.
>
> I'd like to use just:
>
>     git push
>
> or at most:
>
>     git push origin
>
> rather than having to first check which is the active branch with `git
> branch --list`, then type:
>
>     git push origin <branch>
>
> At [1] and [2] I've seen that if I do this once:
>
>     git push -u origin <branch>
>
> then from then on I can use just `git push` _for that branch_.
> However, I don't want to do this "setup" step for each branch, because
> it's extra work that I also may forget to do.
>
> Why is this "setup" step necessary and can I avoid it?
>
> Thanks,
> Stefan
>
> [1] http://stackoverflow.com/q/19312622
> [2] http://stackoverflow.com/q/6529136


Try setting "push.default" configuration setting, see "git help
config" and search for push.default

I *think* what you want is "push.default = current" but you should
read up on each option.

Thanks,
Jake

```

## Stefan Monov, 2016-12-27 17:47

Subject: Re: Making it possible to do “git push origin” instead of “git push origin <branch>”, without having to one-time prepare each branch for it
Message-ID: <CAJtFkWvE7_owqH0KET++Oxv9pDmygwnmDMnOE2r14hQN6BxFgw@mail.gmail.com>
URL: https://gitlist.dev/e/CAJtFkWvE7_owqH0KET%2B%2BOxv9pDmygwnmDMnOE2r14hQN6BxFgw%40mail.gmail.com
In-Reply-To: <CA+P7+xpdKEoNY_cgY4g3bMVZe0p-2bYT4Y-3nYyd0O03iD1nZg@mail.gmail.com>

```
Thanks guys!

```
