Re: [git-users] Easy question about merging

2013-10-12 Thread Magnus Therning
On Thu, Oct 10, 2013 at 03:41:03PM -0700, Eric Fowler wrote:
 I am a git newbie but have used other SCMs.
 
 I have two branches, master and X. Both have changes, both have been
 committed. X has a lot of refactoring changes, master has a few bug
 fixes I don't want to lose. 
 
 I want to merge X into master. But I'm chicken. What if the merge
 fails and leaves me with broken code? There is a deadline coming up
 and that would be disastrous.

Remember, you can always revert after a normal merge by rolling back
the heads of each branch.

 So I want to know exactly what I have to do merge, *knowing* that I
 can easily get to *exactly what I have now*. 

This makes little sense since exactly what you have now are two
branches that differ.  I assume you want something that contains a mix
of the changes with the same behaviour as you have now ;)

 What are the steps? Will 'git checkout master; git merge X
 --no-commit' do it? 

There's no strict requirement to not commit, just don't push the merge
changeset until you've verified that everything is as it should be.
If need be you can always amend the merge changeset.

You might want to have a look at the [imerge command][1], it took me a
bit of thinking to understand the theory behind it, but once I started
using it it's made merges a bit easier.

/M

[1]: https://github.com/mhagger/git-imerge

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4 
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

The British have the perfect temperament to be hackers--technically
skilled, slightly disrespectful of authority, and just a touch of
criminal behavior.
 -- Mary Ann Davidson, Oracle's Security Chief


pgpumsgplE6Qw.pgp
Description: PGP signature


Re: [git-users] Easy question about merging

2013-10-11 Thread Gergely Polonkai
Hello,

Another approach is to try to rebase X on master. The following works only
if branch X was created from master.

$ git checkout X
$ git rebase master

As you mentioned, X is a refactored version, it is more than likely that
you will encounter merge conflicts during the process. However, if you feel
panicked at such a conflict, you can cancel your rebase and get back to the
original X branch in no time.

After you fix the conflicts, you can safely do

$ git checkout master
$ git merge X

Cheers,
Gergely


On 11 October 2013 04:21, Huu Da Tran huuda.t...@gmail.com wrote:

 If you really want to stay on the safe side, this would be the easiest and
 safest for you.

 git checkout branchX
 git checkout -b branchX-merge-master
 git merge master

 fix any conflicts, do your tests. Commit conflict changes. When you are
 happy, repeat

 git merge master

 Until everything is up to date. This is just if any commits are added to
 master in the meantime. When you are very happy

 git checkout master
 git merge branchX-merge-master

 And voilĂ .

 Hope everything is clear. I am typing on a phone. If you need more details
 or explanations, i'll get on a computer and give a more detail step by step.

 HD.

 --
 You received this message because you are subscribed to the Google Groups
 Git for human beings group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to git-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[git-users] Easy question about merging

2013-10-10 Thread Eric Fowler
I am a git newbie but have used other SCMs.

I have two branches, master and X. Both have changes, both have been 
committed. X has a lot of refactoring changes, master has a few bug fixes I 
don't want to lose. 

I want to merge X into master. But I'm chicken. What if the merge fails and 
leaves me with broken code? There is a deadline coming up and that would be 
disastrous.

So I want to know exactly what I have to do merge, *knowing* that I can 
easily get to *exactly what I have now*. 

What are the steps? Will 'git checkout master; git merge X --no-commit' do 
it? 

Thanks

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[git-users] Easy question about merging

2013-10-10 Thread Huu Da Tran
If you really want to stay on the safe side, this would be the easiest and 
safest for you.

git checkout branchX
git checkout -b branchX-merge-master
git merge master

fix any conflicts, do your tests. Commit conflict changes. When you are happy, 
repeat

git merge master

Until everything is up to date. This is just if any commits are added to master 
in the meantime. When you are very happy

git checkout master
git merge branchX-merge-master

And voilĂ .

Hope everything is clear. I am typing on a phone. If you need more details or 
explanations, i'll get on a computer and give a more detail step by step.

HD.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.