On Wed, Sep 15, 2010 at 05:10:53PM +0900, David wrote:
> It is very difficult to actually lose data with git thanks to the
> reflog:
>http://www.gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html
Unless you use the 'force' switches. I am trying very hard not to
use them, as I have been advised by several good git users.
But I keep getting in situations where people tell me that I need to use
one of these switches. It's always a bit hard to explain how I get there,
but I'll try and do so, so that knowledgeable people can advice me on the
right solutions.
Here is an example (in chronological order):
1) Branch out a feature branch 'feature' from master.
2) Develop in feature branch (cycle of code/commit...)
3) Hot bug on master, checkout master, attempt to fix bug. Bug fix
induces other bugs, cycle of code/commit to fix them.
4) Decide that bug fix is not mature enough to push, but feature branch
got reviewed and is.
5) Discover that I can't push from feature to origin/master. Conclude
that I must merge back in master locally.
Now I have a problem: at step 1 I should have created a branch. I did
not. I need to go back and create a branch. This was happening at a
sprint, and people that know git better than me helped me out. But the
only way we found to sort this out was to create a branch at step 1,
merge the branch with master, and 'reset -a' master at step 1. I thought
it over quite a few times, and did not loose any data. However, I was
very uncomfortable with the process (the 'reset -a').
What was the right solution (apart from 'create branch at step 1')?
This really illustrates what git feels like me: linux in root mode,
powerful, unsafe if you don't understand it well.
Gaël