{"thread":{"id":"13275","subject":"Merge *to* branch instead of merge *from* branch?","startedAt":"2008-04-26T22:42:23Z","lastAt":"2008-04-27T02:19:23Z","messageCount":3,"participants":["Peter Karlsson","Avery Pennarun","Kelvie Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"75241","messageId":"alpine.DEB.1.00.0804270037220.1149@perkele.intern.softwolves.pp.se","threadId":"13275","inReplyTo":null,"subject":"Merge *to* branch instead of merge *from* branch?","fromName":"Peter Karlsson","fromEmail":"peter@softwolves.pp.se","sentAt":"2008-04-26T22:42:23Z","receivedAt":"2008-04-26T22:42:23Z","isPatch":false,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Hi!\n\nMy most common use-case of Git is currently somewhere along the lines of\n\n   git checkout master # start from here\n   git checkout -b new_branch\n   ...edit...\n   ...commit...\n   git merge master # to make sure I have the latest changes\n   ...make sure it all works...\n   git checkout master\n   git merge new_branch # fast-forwards master to new_branch's HEAD\n\nIs there any way of not having to do the \"git checkout master\" first? \nBasically I want a flag to merge or checkout saying that I want to merge my \nbranch into the branch I'm switching to. I can't seem to find any such flag.\n\n(My problem is not that I have to write two commands, the problem is that \nchecking out master and then fast-forwarding it back to where I was is slow, \nworking on a network-mapped share on Win32 as I am, and it causes the \nancient compiler I'm using to re-compile nearly everything, which is also \nslow).\n\n-- \n\\\\// Peter - http://www.softwolves.pp.se/\n"},{"id":"75242","messageId":"32541b130804261617y1fb2a8d9jf8fc6f58ca07b44f@mail.gmail.com","threadId":"13275","inReplyTo":"alpine.DEB.1.00.0804270037220.1149@perkele.intern.softwolves.pp.se","subject":"Re: Merge *to* branch instead of merge *from* branch?","fromName":"Avery Pennarun","fromEmail":"apenwarr@gmail.com","sentAt":"2008-04-26T23:17:32Z","receivedAt":"2008-04-26T23:17:32Z","isPatch":false,"sender":{"key":"apenwarr@gmail.com","avatar":"https://avatars.githubusercontent.com/u/20592?v=4"},"body":"On 4/26/08, Peter Karlsson <peter@softwolves.pp.se> wrote:\n>  Is there any way of not having to do the \"git checkout master\" first?\n> Basically I want a flag to merge or checkout saying that I want to merge my\n> branch into the branch I'm switching to. I can't seem to find any such flag.\n\nHow about this?\n\ngit merge master\ngit branch -D master\ngit branch master HEAD\n\nIn other words, just make a copy of your current branch after merging\nand call it the new 'master'.  That's all fast forwarding would do\nanyhow.\n\nHave fun,\n\nAvery\n"},{"id":"75249","messageId":"94ccbe710804261919u5aa5406cnd26f2eb4ff44990a@mail.gmail.com","threadId":"13275","inReplyTo":"alpine.DEB.1.00.0804270037220.1149@perkele.intern.softwolves.pp.se","subject":"Re: Merge *to* branch instead of merge *from* branch?","fromName":"Kelvie Wong","fromEmail":"kelvie@ieee.org","sentAt":"2008-04-27T02:19:23Z","receivedAt":"2008-04-27T02:19:23Z","isPatch":false,"sender":{"key":"kelvie@ieee.org","avatar":null},"body":"On Sat, Apr 26, 2008 at 3:42 PM, Peter Karlsson <peter@softwolves.pp.se> wrote:\n> Hi!\n>\n>  My most common use-case of Git is currently somewhere along the lines of\n>\n>   git checkout master # start from here\n>   git checkout -b new_branch\n>   ...edit...\n>   ...commit...\n>   git merge master # to make sure I have the latest changes\n>   ...make sure it all works...\n>   git checkout master\n>   git merge new_branch # fast-forwards master to new_branch's HEAD\n>\n>  Is there any way of not having to do the \"git checkout master\" first?\n> Basically I want a flag to merge or checkout saying that I want to merge my\n> branch into the branch I'm switching to. I can't seem to find any such flag.\n>\n\nI believe what you are looking for is in in the \"push\" command.\n\ngit push . new_branch:master # pushes your changes into master.\n\n-- \nKelvie Wong\n"}]}