git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Merge *to* branch instead of merge *from* branch?
@ 2008-04-26 22:42 Peter Karlsson
  2008-04-26 23:17 ` Avery Pennarun
  2008-04-27  2:19 ` Kelvie Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Karlsson @ 2008-04-26 22:42 UTC (permalink / raw)
  To: git

Hi!

My most common use-case of Git is currently somewhere along the lines of

   git checkout master # start from here
   git checkout -b new_branch
   ...edit...
   ...commit...
   git merge master # to make sure I have the latest changes
   ...make sure it all works...
   git checkout master
   git merge new_branch # fast-forwards master to new_branch's HEAD

Is there any way of not having to do the "git checkout master" first? 
Basically I want a flag to merge or checkout saying that I want to merge my 
branch into the branch I'm switching to. I can't seem to find any such flag.

(My problem is not that I have to write two commands, the problem is that 
checking out master and then fast-forwarding it back to where I was is slow, 
working on a network-mapped share on Win32 as I am, and it causes the 
ancient compiler I'm using to re-compile nearly everything, which is also 
slow).

-- 
\\// Peter - http://www.softwolves.pp.se/

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

* Re: Merge *to* branch instead of merge *from* branch?
  2008-04-26 22:42 Merge *to* branch instead of merge *from* branch? Peter Karlsson
@ 2008-04-26 23:17 ` Avery Pennarun
  2008-04-27  2:19 ` Kelvie Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Avery Pennarun @ 2008-04-26 23:17 UTC (permalink / raw)
  To: Peter Karlsson; +Cc: git

On 4/26/08, Peter Karlsson <peter@softwolves.pp.se> wrote:
>  Is there any way of not having to do the "git checkout master" first?
> Basically I want a flag to merge or checkout saying that I want to merge my
> branch into the branch I'm switching to. I can't seem to find any such flag.

How about this?

git merge master
git branch -D master
git branch master HEAD

In other words, just make a copy of your current branch after merging
and call it the new 'master'.  That's all fast forwarding would do
anyhow.

Have fun,

Avery

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

* Re: Merge *to* branch instead of merge *from* branch?
  2008-04-26 22:42 Merge *to* branch instead of merge *from* branch? Peter Karlsson
  2008-04-26 23:17 ` Avery Pennarun
@ 2008-04-27  2:19 ` Kelvie Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Kelvie Wong @ 2008-04-27  2:19 UTC (permalink / raw)
  To: Peter Karlsson; +Cc: git

On Sat, Apr 26, 2008 at 3:42 PM, Peter Karlsson <peter@softwolves.pp.se> wrote:
> Hi!
>
>  My most common use-case of Git is currently somewhere along the lines of
>
>   git checkout master # start from here
>   git checkout -b new_branch
>   ...edit...
>   ...commit...
>   git merge master # to make sure I have the latest changes
>   ...make sure it all works...
>   git checkout master
>   git merge new_branch # fast-forwards master to new_branch's HEAD
>
>  Is there any way of not having to do the "git checkout master" first?
> Basically I want a flag to merge or checkout saying that I want to merge my
> branch into the branch I'm switching to. I can't seem to find any such flag.
>

I believe what you are looking for is in in the "push" command.

git push . new_branch:master # pushes your changes into master.

-- 
Kelvie Wong

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

end of thread, other threads:[~2008-04-27  2:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-26 22:42 Merge *to* branch instead of merge *from* branch? Peter Karlsson
2008-04-26 23:17 ` Avery Pennarun
2008-04-27  2:19 ` Kelvie Wong

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