[kwlug-disc] Advanced(?) Git usage question

Chris Frey cdfrey at foursquare.net
Mon Apr 21 21:23:58 EDT 2014


On Thu, Apr 17, 2014 at 12:00:12AM -0400, John Johnson wrote:
> Earlier I asked:
> /What happens if I have modified a file in one of the branches?

[snipped long example]

When you checkout a new branch, as long as none of the files are
changed in both the working tree and the new branch, the checkout
is successful.  If such files do exist, by default you will get a
warning.

If you really want to switch branches, and you believe the changes
won't conflict, you can use the -m option to merge your working tree
changes with the new branch you're checking out.


> $ git checkout rewind_2f7c343 (switch to branch)
> $ git commit -a
> to commit changes to indexTest.php

You may want to start breaking this habit now. :-)  Try:

	git add indexText.php
or
	git add -p

	git commit


> Now, the trick I have at hand is to merge the changes in
> indexTest.php made in rewind_2f7c343 with the other branches.
> And do this so that only the problem with behaviour w is addressed,
> i.e. without affecting the other behaviours present in the other
> branches.

Why did you commit this change to rewind_2f7c343 as opposed to another branch?
The answer might assist you in determining the best route for merging.

Again, my theory is that bugfixes belong in master (or your equivalent
rc branch) ASAP.  So if rewind_2f7c343 will be merged to master soon,
then you can merge it, and rebase the others on top of master.

- Chris





More information about the kwlug-disc mailing list