On Wed, 26 Jun 2013 11:18:58 +0530
Shouvik <cance...@gmail.com> wrote:

> > > Yes, pass the "--no-commit" option to `git merge` and it won't
> > > automatically record a merge commit but will rather leave the
> > > changes staged in the index.  Then you'll be able to unstage the
> > > changes made to index.php by running
> > >
> > > $ git reset index.php
> > >
> > > After that, commit as usually.

[...]

> Ok so please confirm if the following steps are okay (assuming that
> currently I am in *bugfix* branch)

No, one crucial step is missing -- see below.

> >git commit -m "major bug fixing" register.php login.php index.php
> >git checkout master
> >git merge --no-commit bugfix

Notice that here we explicitly told Git to *not* record a merge commit,
just leave in the index (and the work tree) whatever changes the merge
operation did to them.

> >git reset index.php

At this point run `git status`, `git diff --cached` and confirm for
yourself you're okay with the changes about to be committed.  This is a
good habit you're really advised to develop -- do not ever commit
blindly (unless you're absolutely sure).

> >git push origin master

Too early: you have not committed the changes introduced by the
merge operation yet!  Hence there's supposedly nothing to push.
Now please scroll back to the quote from my original message above,
which reads "After that, commit as usually"...

Note that this case is really not rocket science.  For some reason, you
appear to perceive it as some sort of black magic which it really isn't:

1) Any merge operation which does not resolve in fast-forwarding the
   receiving branch, -- and this only ever happens if the branch being
   merged ("the other side") completely contains the receiving branch
   in its history, so there's no point in attempting a true merge --
   results in a new commit which a) records all the changes introduced
   by the merge, and b) refers to all the branches which participated
   in merging.

2) Since you want to tweak the result of the merge operation (drop
   the changes which it does to one file) you explicitly tell Git to
   not auto-commit the result.  Consequently, you have to commit the
   (tweaked) state by hand.

Please, don't try to *memorize* what to do, try hard to understand
*what* each of the steps does, and why -- you have all the information.

If you feel lost with what `git merge`, `git reset` and `git commit` do,
it's time to read the book and study other pointers (like that article
on `git reset` I linked to in my first reply to this thread).

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


Reply via email to