# git push should automatically push to remote tracking branch

4 messages from 2009-10-18 to 2009-10-19. Participants: Mohit Aron, Tomas Carnecky, Jeff King.
Thread: https://gitlist.dev/t/21272

## Mohit Aron, 2009-10-18 20:20

Subject: git push should automatically push to remote tracking branch
Message-ID: <ee22b09e0910181320j15a273e8vc510801c890b93a9@mail.gmail.com>
URL: https://gitlist.dev/e/ee22b09e0910181320j15a273e8vc510801c890b93a9%40mail.gmail.com

```
Hello,

I've been using git for around a year now and I'm continuing to find
the 'git push' API rather cumbersome. My workflow is as follows. I
typically have a local branch track a remote branch and want to pull
and push changes back and forth. The names of the local and remote
branches are different. Even so, while 'git pull' is enough to pull
changes, 'git push' is not. Instead, the pull requires a full refspec
to be specified which gets real cumbersome and error prone.

Say my local branch name is foo and it is tracking a remote release
branch of a product. Say the remote's name is origin and corresponding
branch there is 6.1. 'git pull' nicely fetches and merges changes
submitted by others in the remote branch to my branch foo. However, to
do a push, I need to call:

      git push origin HEAD:6.1

Since my local branch has been setup to track the remote branch, I
shouldn't have to specify all this in the 'git push' command. It'll be
great if 'git push' were to support a variant that automatically
allows pushing to the remotely tracked branch. This is the typical
workflow with other version control systems too.

If anyone knows a simpler alternative I can use in Git, please let me
know. Otherwise, it'll be great if such a feature could be added to
Git in the future.


- Mohit

```

## Tomas Carnecky, 2009-10-18 23:11

Subject: Re: git push should automatically push to remote tracking branch
Message-ID: <1B59440B-5929-4AB9-82C7-05188DC4F959@dbservice.com>
URL: https://gitlist.dev/e/1B59440B-5929-4AB9-82C7-05188DC4F959%40dbservice.com
In-Reply-To: <ee22b09e0910181320j15a273e8vc510801c890b93a9@mail.gmail.com>

```

On Oct 18, 2009, at 10:20 PM, Mohit Aron wrote:

> Hello,
>
> I've been using git for around a year now and I'm continuing to find
> the 'git push' API rather cumbersome. My workflow is as follows. I
> typically have a local branch track a remote branch and want to pull
> and push changes back and forth. The names of the local and remote
> branches are different. Even so, while 'git pull' is enough to pull
> changes, 'git push' is not. Instead, the pull requires a full refspec
> to be specified which gets real cumbersome and error prone.
>
> Say my local branch name is foo and it is tracking a remote release
> branch of a product. Say the remote's name is origin and corresponding
> branch there is 6.1. 'git pull' nicely fetches and merges changes
> submitted by others in the remote branch to my branch foo. However, to
> do a push, I need to call:
>
>       git push origin HEAD:6.1
>
> Since my local branch has been setup to track the remote branch, I
> shouldn't have to specify all this in the 'git push' command. It'll be
> great if 'git push' were to support a variant that automatically
> allows pushing to the remotely tracked branch. This is the typical
> workflow with other version control systems too.
>
> If anyone knows a simpler alternative I can use in Git, please let me
> know. Otherwise, it'll be great if such a feature could be added to
> Git in the future.

$ git config push.default tracking

tom

```

## Mohit Aron, 2009-10-19 03:50

Subject: Re: git push should automatically push to remote tracking branch
Message-ID: <ee22b09e0910182050k55efac83v6799285d992fcbb0@mail.gmail.com>
URL: https://gitlist.dev/e/ee22b09e0910182050k55efac83v6799285d992fcbb0%40mail.gmail.com
In-Reply-To: <1B59440B-5929-4AB9-82C7-05188DC4F959@dbservice.com>

```
Thanks - I suppose this is a new config option. I'm running Git
version 1.6.0.4 (the latest with Ubuntu Jaunty) and that doesn't seem
to have this option.


- Mohit

>
> $ git config push.default tracking
>
> tom
>
>

```

## Jeff King, 2009-10-19 05:06

Subject: Re: git push should automatically push to remote tracking branch
Message-ID: <20091019050627.GA16255@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20091019050627.GA16255%40coredump.intra.peff.net
In-Reply-To: <ee22b09e0910182050k55efac83v6799285d992fcbb0@mail.gmail.com>

```
On Sun, Oct 18, 2009 at 08:50:57PM -0700, Mohit Aron wrote:

> Thanks - I suppose this is a new config option. I'm running Git
> version 1.6.0.4 (the latest with Ubuntu Jaunty) and that doesn't seem
> to have this option.

Yes, it was added in v1.6.3.

-Peff

```
