> "You go to commit some code to a public repo. The maintainer scolds you for using merges instead of fast forwards."
Imagine you clone a repo. So your version is identical. You now add a couple more commits to master. Now, to make them identical again, all you have to do is upload the new commits, and then get his master branch to update to point to the latest one. Makes sense, right? That's a fast-forward.
Instead, what you do is merge your latest commit with the older commit two back, which creates a third commit with identical content to the previous one. That's silly, right? That's why fast-forward instead of merge.
> "You decide to bring in some more code from the public repo. Here is a 6000 word essay on what rebase means."
Rebase is when you take the content from a chain of commits, and make a completely new chain with that same content, just because it makes it look neater. You then change the branch from pointing at the head of the old chain to pointing at the head of the new. That's all it does. The old chain is still there until it's garbage collected a few weeks later (or you tag it to stop it disappearing).
> "You try to look at an old version of the code. Suddenly you are in ‘detached HEAD’ state. The End."
I'm not sure what the fear is here, so I'm not sure what to tell you. Create a test repository with a few commits and change the hashes below for real ones:
git checkout master # on master, whew
git checkout e34a53 # oh no, detached head
git checkout master # it's ok, back on master, whew
git checkout 343a34 # oh no, detached head
git checkout master # it's ok, back on master, whew
git checkout fe34ee # oh no, detached head
git checkout master # it's ok, back on master, whew
git checkout a567ed # oh no, detached head
git checkout master # it's ok, back on master, whew
I wrote a deploy script for our QA system that checks out the commit hash we want instead of the branch and leaves it in detached head mode. Works awesome. Needless to say our ops guys were not amused and demanded it leave it on a branch. People can be do stubbornly stupid sometimes.
Imagine you clone a repo. So your version is identical. You now add a couple more commits to master. Now, to make them identical again, all you have to do is upload the new commits, and then get his master branch to update to point to the latest one. Makes sense, right? That's a fast-forward.
Instead, what you do is merge your latest commit with the older commit two back, which creates a third commit with identical content to the previous one. That's silly, right? That's why fast-forward instead of merge.
> "You decide to bring in some more code from the public repo. Here is a 6000 word essay on what rebase means."
Rebase is when you take the content from a chain of commits, and make a completely new chain with that same content, just because it makes it look neater. You then change the branch from pointing at the head of the old chain to pointing at the head of the new. That's all it does. The old chain is still there until it's garbage collected a few weeks later (or you tag it to stop it disappearing).
> "You try to look at an old version of the code. Suddenly you are in ‘detached HEAD’ state. The End."
I'm not sure what the fear is here, so I'm not sure what to tell you. Create a test repository with a few commits and change the hashes below for real ones:
Repeat until you're not panicking? :-)