git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sean Kelley" <svk.sweng@gmail.com>
To: git@vger.kernel.org
Subject: Re: pushing changes to a remote branch
Date: Tue, 10 Jul 2007 22:44:58 -0500	[thread overview]
Message-ID: <a2e879e50707102044l864b9dcre5b6fa5893ff4803@mail.gmail.com> (raw)
In-Reply-To: <844FC382-DFB3-4762-93C2-6512612136AC@silverinsanity.com>

Hi,

On 7/10/07, Brian Gernhardt <benji@silverinsanity.com> wrote:
>
> On Jul 10, 2007, at 1:34 PM, Jeff King wrote:
>
> > On Tue, Jul 10, 2007 at 04:36:14PM +0200, martin f krafft wrote:
> >
> >>   git checkout origin/vim
> >>     Note: moving to "origin/vim" which isn't a local branch
> >>   echo change > newfile; git add newfile
> >>   git commit -m'make change'
> >>     Created commit 64b8b2e: make change
> >>      1 files changed, 1 insertions(+), 0 deletions(-)
> >>       create mode 100644 newfile
> >>
> >> If I now checkout master and then return to origin/vim, the commit
> >> is gone.
> >
> > That's because 'origin/vim' is a tracking branch for the remote; it's
> > where you store the information "here's what the remote 'origin'
> > thinks
> > is in the branch 'vim'." That's why you get the "note" warning above.
> >
> > If you want to make changes, you should make a local branch starting
> > from that point:
> >
> >   git-checkout -b vim origin/vim
> >   # hack hack hack
> >   git-commit -m changes
>
> Indeed, in master, git outputs a hint to that when you checkout the
> remote branch.
>
>    $ git checkout origin/master
>    Note: moving to "origin/master" which isn't a local branch
>    If you want to create a new branch from this checkout, you may do so
>    (now or later) by using -b with the checkout command again. Example:
>      git checkout -b <new_branch_name>
>    HEAD is now at f4855d4... 1
>
> Perhaps git-commit should also also output a warning?  "Commit made
> on detached HEAD.  Use "git branch <new_branch_name>" to save your
> commit"?  That's bad wording, but the idea is there.


If you then do a push from that new_branch_name will it create a new
branch on the remote?  I am struggling with just being able to add a
remote.  Create a local branch that maps to the remote.  Then
committing and pushing changes to the remote - all without creating a
new branch on the remote.

Sean

>
> ~~ Brian
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  parent reply	other threads:[~2007-07-11  3:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-10 14:36 pushing changes to a remote branch martin f krafft
2007-07-10 17:34 ` Jeff King
2007-07-10 18:10   ` Brian Gernhardt
2007-07-10 22:04     ` Jeff King
2007-07-11  3:44     ` Sean Kelley [this message]
2007-07-11 19:34       ` Jan Hudec
2007-07-11 19:31     ` Jan Hudec
2007-07-11 21:26       ` Junio C Hamano
2007-07-14  8:38         ` Jan Hudec
2007-07-11 19:29 ` Jan Hudec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2e879e50707102044l864b9dcre5b6fa5893ff4803@mail.gmail.com \
    --to=svk.sweng@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).