Live data from Hacker News

Git Tips And Workflows

durdn.com

1–10 of 40 posts

Re: Git Tips And Workflows

#3
I was not aware of the `git config` option for wrapping long files, worth the price of admission just for that for me.

Edit: there's a `git diff` tip in there, but this comes up a few times so if anyone needs to do patches from git for svn repos do `git patch --prefix=none $DIFF1 $DIFF2 > some.patch` share and apply with `patch -p0 < some.patch`.

Re: Git Tips And Workflows

#4

Curated eh?

You have to admit it's a lot better than the recent "12 git tips written by a finite number of monkeys with typewriters and a finite amount of time".

They're actually pretty good tips, "curated" or ... not - however that would work.

Re: Git Tips And Workflows

#7

I was not aware of the `git config` option for wrapping long files, worth the price of admission just for that for me. Edit: there's a `git diff` tip in there, but this comes up a few times so if anyone needs to do patches from git for svn repos do `git patch --prefix=none $DIFF1 $DIFF2 > some.patch` share and apply with `patch -p0 < some.patch`.

Or just:

  git diff REV1 REV2 >some.patch
  patch -p1 

Re: Git Tips And Workflows

#8
post #7

I was not aware of the `git config` option for wrapping long files, worth the price of admission just for that for me. Edit: there's a `git diff` tip in there, but this comes up a few times so if anyone needs to do patches from git for svn repos do `git patch --prefix=none $DIFF1 $DIFF2 > some.patch` share and apply with `patch -p0 < some.patch`.

Or just: git diff REV1 REV2 >some.patch patch -p1

I found when I was doing that it would occasionally cause problems with applying in svn properly, but YMMV. I've seen some really over the top solutions to it as well.

Re: Git Tips And Workflows

#9

>> Zero a branch to do something radically different There's another way to do this: git checkout --orphan new-branch

Last time I tried this, I was getting a lot of hassle when switching between branches that have no common ancestor; .gitignored files disappearing completely (very annoying when you keep a local config file around etc.), files left over and "not staged for commit" instead of being removed, etc. Maybe the "empty root commit" trick would help, I haven't tested that they.

Re: Git Tips And Workflows

#10

I was not aware of the `git config` option for wrapping long files, worth the price of admission just for that for me. Edit: there's a `git diff` tip in there, but this comes up a few times so if anyone needs to do patches from git for svn repos do `git patch --prefix=none $DIFF1 $DIFF2 > some.patch` share and apply with `patch -p0 < some.patch`.

I don't see that Git has a "patch" command, but svn does -- is that what you meant here? Where you have "git patch", did you maybe mean:

    git diff --no-prefix $OLD $NEW
...where $OLD and $NEW are the two commits you want to diff.
Post reply on HN