On Thu, 20 Jun 2013 17:35:54 +0530
Shouvik <cance...@gmail.com> wrote:

> > > Suppose I have a project on MASTER branch with 100s of php files.
> > > To do a bug fixing in the project, i create a separate branch
> > >
> > > *>git checkout -b bugfix*
> > >
> > > Then after fixing the bug in 3 files (for eg index.php,
> > > register.php and login.php), i merge it in the master branch
> > >
> > > *>git checkout master
> > > > **>git merge bugfix*
> > >
> > > The above code will merge all the 3 files i made changes, but is
> > > there anyway that i can force GIT to merge only 2 files, say
> > > login.php and register.php only?
> >
> > 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.
> >
> But u cannot switch branch without commiting first right? and in
> order or merge a branch u need to checkout to the master branch. no?

Of course, when you're merging, you first check out the branch which
receives the merge (which will be the first parent of a prospective
merge commit), and yes, you can only merge commits (not files or
whatnot) since these are basic blocks of which repository history
managed by Git consists.  But what's the problem, really?  If you
recorded a bugfix commit (or a series of commits) on your "bugfix"
branch, you just merge that branch into the (checked out) "master"
branch.  This is just a normal merge, you just prevent auto-creation of
a merge commit and then rip out unwanted changes before actually making
a commit.

> Or am I missing something? Can u specify the steps pls?

No, you have to develop understanding of what you need to do and why,
not just be able to copy & paste a canned solution.

Please don't top-post -- this breaks discussion flow.

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