git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Make it easy to use branch --track on existing branch
@ 2010-01-17 14:06 Matthieu Moy
  2010-01-17 14:06 ` [PATCH 1/2] branch: allow creating a branch with same name and same starting point Matthieu Moy
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Matthieu Moy @ 2010-01-17 14:06 UTC (permalink / raw)
  To: git, gitster; +Cc: Matthieu Moy

I'm starting a new thread to avoid hiding the message in another one,
but this is a followup to a message in the "git push --track" thread:

http://article.gmane.org/gmane.comp.version-control.git/137066

I wrote:
> Junio C Hamano <gitster <at> pobox.com> writes:
> 
> > The small nit is that "branch -f --track me origin/me" will happily
> > overwrite "me", even when your "me" is not up to date with "origin/me",
> > losing commits.
> 
> And another issue is:
> 
> $ git branch -f --track my-branch origin/my-branch
> fatal: Cannot force update the current branch.
> $ git branch --track my-branch origin/my-branch
> fatal: A branch named 'my-branch' already exists.
> 
> Actually, I just can't find a natural set of commands doing:
> 
> 1. create a branch (git checkout -b)
> 2. work on it
> 3. send it upstream (git push)
> 4. set the upstream as tracking (???)
> 
> with the current version of Git. I just do 4. with $EDITOR
> .git/config ...

The first patch makes it possible to use branch --track on an existing
branch (checked-out or not, regardless of -f), and the second warns on
a newly introduced irrelevant case.

This should be a nice complement to "push --set-upstream". I think
"push --set-upstream" is the most natural in 99% of cases, but using
"git branch" should work too.

Matthieu Moy (2):
  branch: allow creating a branch with same name and same starting
    point.
  branch: warn and refuse to set a branch as a tracking branch of
    itself.

 branch.c                 |   59 ++++++++++++++++++++++++++++++++-------------
 t/t6040-tracking-info.sh |    8 ++++++
 2 files changed, 50 insertions(+), 17 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH 0/2] Branch --set-upstream
@ 2010-01-18 20:44 Ilari Liusvaara
  2010-01-18 20:44 ` [PATCH 2/2] branch: warn and refuse to set a branch as a tracking branch of itself Ilari Liusvaara
  0 siblings, 1 reply; 8+ messages in thread
From: Ilari Liusvaara @ 2010-01-18 20:44 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Matthieu Moy

This adds new switch --set-upstream that can set upstream information
on existing branch branch without changing where the branch points
to.

push --set-upstream doesn't help if user doesn't have push priviledges
or if user is not up to date with upstream. Forcing branch recreate
is not possible if user has own patches appiled to the branch.

This series is edited version of Matthieu Moy's branch --track patch
series. The first patch is edited, the second is resent as-is.

Ilari Liusvaara (1):
  Add branch --set-upstream

Matthieu Moy (1):
  branch: warn and refuse to set a branch as a tracking branch of
    itself.

 Documentation/git-branch.txt |    8 ++++++-
 branch.c                     |   45 ++++++++++++++++++++++++++++++-----------
 builtin-branch.c             |    2 +
 cache.h                      |    1 +
 t/t6040-tracking-info.sh     |   21 +++++++++++++++++++
 5 files changed, 64 insertions(+), 13 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-01-18 20:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-17 14:06 [PATCH 0/2] Make it easy to use branch --track on existing branch Matthieu Moy
2010-01-17 14:06 ` [PATCH 1/2] branch: allow creating a branch with same name and same starting point Matthieu Moy
2010-01-17 19:38   ` Junio C Hamano
2010-01-17 14:06 ` [PATCH 2/2] branch: warn and refuse to set a branch as a tracking branch of itself Matthieu Moy
2010-01-17 14:40 ` [PATCH 0/2] Make it easy to use branch --track on existing branch Ilari Liusvaara
2010-01-17 14:53   ` Matthieu Moy
2010-01-17 15:29     ` Ilari Liusvaara
  -- strict thread matches above, loose matches on Subject: below --
2010-01-18 20:44 [PATCH 0/2] Branch --set-upstream Ilari Liusvaara
2010-01-18 20:44 ` [PATCH 2/2] branch: warn and refuse to set a branch as a tracking branch of itself Ilari Liusvaara

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).