March 16, 2012
"H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote in message news:mailman.719.1331847338.4860.digitalmars-d-learn@puremagic.com...

> Actually, I discovered that my origin/master branch was also broken (probably due to running the wrong git command in it in the past), because it had a bunch of commits from upstream that for some reason had different hashes (maybe the result of attempting to merge from a messed up branch?). This is probably why my topic branch was messed up in the first place, I think.
>
> So I did git reset --hard to clean up the history back to the point where it first starting diverging, then pulled from upstream/master (which I confirmed were fast-forward). Then I used `git push -f master` to clean up the history on github. So that takes care of master.
>

I used to have this problem all the time - now I have a script which checks out master and pulls with -ff-only (in all three repositories) giving me a nice big error if I accidentally committed to master.  Although I think I just lost it when my hard drive died yesterday...

Get to know rebase -i as well, it can be very useful for untangling history.


March 16, 2012
On 16 March 2012 16:35, H. S. Teoh <hsteoh@quickfur.ath.cx> wrote:
> [...]
>> I used to have this problem all the time - now I have a script which checks out master and pulls with -ff-only (in all three repositories) giving me a nice big error if I accidentally committed to master. Although I think I just lost it when my hard drive died yesterday...
>
> Ahh, thanks for the tip. I'll probably always use -ff-only from now on. It's always such a mess to clean up if non-ff commits get merged in by a pull. Prevention is better than cure, as they say.
>
>
>> Get to know rebase -i as well, it can be very useful for untangling history.
> [...]
>
> Yeah I tried that too, but in my case it was easier to just reset HEAD back to wherever it diverged from and rerun the pull.
>

Generally I find that pulls should be rebased, ff-only, and local merges done with --no-ff. This means that you have merge history in the tree, which can be useful when trying to do code archaeology, and pulls are forced to be merged properly, rather than using a merge commit, avoiding annoying messages in the log.

Git is a strange beast, one moment it is peacful and helpful, the next it is scary and threatening to eat your files.

Also, git-svn isn't actually that bad...

--
James Miller
March 16, 2012
On Fri, Mar 16, 2012 at 04:52:35PM +1300, James Miller wrote: [...]
> Generally I find that pulls should be rebased, ff-only, and local merges done with --no-ff. This means that you have merge history in the tree, which can be useful when trying to do code archaeology, and pulls are forced to be merged properly, rather than using a merge commit, avoiding annoying messages in the log.

Why should merges be --no-ff? Doesn't that create a whole bunch of "spurious" commits in the history?


> Git is a strange beast, one moment it is peacful and helpful, the next it is scary and threatening to eat your files.
[...]

The way you worded it made me misread the last phrase as "threatening to eat your face". :-P


T

-- 
Skill without imagination is craftsmanship and gives us many useful objects such as wickerwork picnic baskets.  Imagination without skill gives us modern art. -- Tom Stoppard
March 16, 2012
On 2012-03-16 04:52, James Miller wrote:
> Also, git-svn isn't actually that bad...

It is. You can't properly use git because you have to make sure it's compatible with svn, like linear history. If you don't have a linear history you're in big trouble.

-- 
/Jacob Carlborg
March 16, 2012
On Friday, March 16, 2012 08:52:47 Jacob Carlborg wrote:
> On 2012-03-16 04:52, James Miller wrote:
> > Also, git-svn isn't actually that bad...
> 
> It is. You can't properly use git because you have to make sure it's compatible with svn, like linear history. If you don't have a linear history you're in big trouble.

Yeah. I use git-svn at work, because I like it a lot better than using pure svn, but it's _nowhere_ near as good as pure git. There are just too many features that you have to be careful with or avoid.

- Jonathan M Davis

March 16, 2012
On 2012-03-16 09:08, Jonathan M Davis wrote:
> On Friday, March 16, 2012 08:52:47 Jacob Carlborg wrote:
>> On 2012-03-16 04:52, James Miller wrote:
>>> Also, git-svn isn't actually that bad...
>>
>> It is. You can't properly use git because you have to make sure it's
>> compatible with svn, like linear history. If you don't have a linear
>> history you're in big trouble.
>
> Yeah. I use git-svn at work, because I like it a lot better than using pure
> svn, but it's _nowhere_ near as good as pure git. There are just too many
> features that you have to be careful with or avoid.

Exactly, you need to be very careful and follow a strict workflow to avoid breaking svn.

-- 
/Jacob Carlborg
1 2
Next ›   Last »