Better HN
topnewbestaskshowjobs
Log inSign up

kahkeng

9 karma · joined Mar 2, 2011 (15y ago) · 4 submissions

Submissions

comment 5y ago · link · parent

I find it pretty useful to use the `--patch` or `-p` option (also a mnemonic for "prompt") to various commands:

`git add -p`: prompt which hunks should be added to staging

`git checkout -p`: prompt which unstaged hunks should be thrown away

`git checkout HEAD^ -p`: prompt which hunks from HEAD should be discarded

`git reset -p`: prompt which currently-staged hunks should be unstaged

`git reset HEAD^ -p`: prompt which hunks from the HEAD commit should be unstaged

Nice thing is that you get interactive yes/no prompts with a preview of the change for each hunk, and you can also quit early if you realize it's not the command you want.

Doesn't fully address the potential for lost changes, but slows it down by adding an interactive roadblock for each change.

comment 6y ago · link · parent

I believe this is the HN article you're referring to: https://news.ycombinator.com/item?id=22160572

comment 9y ago · link · parent

Yes I've noticed that this has become a worse experience over time. I used to be able to find previously visited sites easily but now I can't because suggestions take precedence over even exact substring matches of urls.

4.

Codesprint Quora: the first-ever company Codesprint(quora.com ↗)

3 points · by kahkeng · 14y ago · discuss