Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

git is like cpp, you have to use a subset:

- push

- pull

- checkout

- checkout -b

- merge —ff-only

- stash

- stash pop

- reset —hard origin/master

- reset —soft $hash

- commit -m



Interesting exercise. Mine looks more like:

- push/fetch: I personally never liked pull, it's sugar over fetch and merge/rebase.

- checkout -b: haven't looked into all the switch stuff yet

- rebase -i: my bread and butter. I rarely use merge aside from PRs where rebase bugs people.

- add/commit -am: obviously required

- cherry-pick/reset: pretty much replaces stash without introducing a whole new set of tools

- diff/log/status: if you get comfortable with these, you're not going to wedge yourself ever again

- brach: very much an unsung hero. If you get comfortable with commiting often and using brach. You can't ever lose your place doing anything ever again.


lately i’ve been using stash, reset hard, stash pop. work on a single patch over main.

use a backup branch prior to stash, just in case.


That's reasonable, but I think a commit + a rebase -i of just that single commit gets you to the same place. And now your backup branch can preserve the code you would have stashed.


rebase is a multi stage command that often requires force push. as good as it can be, discouraging it’s use, especially in contexts where git is considered challenging, is probably the play.


That's a really good point.


> pull

I find that command too dangerous. I only use git fetch and git merge --ff-only.

You forgot git tag


accurate.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: