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

> pointers to commits

Or to use the name git gives to that concept, "refs." Thus reflog :)

Also, one thing that I've found hasn't occurred to most people using git, is that all the branch/tag/etc refs of your fetched remotes, are also refs, able to be referenced anywhere you can name a ref.

For example, if you ever want to say "I don't care what's on this branch, don't fast-forward or merge or rebase, just overwrite my local branch with what's on the remote!" then that'd be:

    git checkout foo
    git reset --hard origin/foo


> Or to use the name git gives to that concept, "refs." Thus reflog :)

A command name that I read as re-flog for the longest time :D. I really wondered about the strange, strange name for quite a while before I bothered to look up what it does and found out that I should read it as ref-log and that it is, indeed, a very useful thing.


The humans will be flogged and reflogged until they understand the distributed version control


I had the same experience for the longest time until one day I'd have to "re-flog" my local git because I reset some commits that I shouldn't have. Turns out that flogging isn't a real thing in git let alone re-flogging the commits again.


Ah yes, the fact that git brings the remote stuff locally when you `git pull` and all the `origin/<whatever>` are just branch names is something that I realised only too late.

As for the refs, yes, good point ;)


When you do 'git fetch'. The 'pull' is just an alias for fetch + merge (or rebase, depending on local settings).


Wow I've been using git for years and for some reason that never clicked for me. Thanks for pointing that out.

Also being a de-refr probably helps.




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

Search: