I have read git
documents but I can't get what is it the intention of detaching branches in git.
When you want to make some change but you don't want that them be part of your branch you can detach your branch. From A Visual Git Reference:
When HEAD is detached, commits work like normal, except no named branch gets updated. (You can think of this as an anonymous branch.)
Once you check out something else, say master, the commit is (presumably) no longer referenced by anything else, and gets lost. Note that after the command, there is nothing referencing 2eecb.
on the other hand, you want to save this state, you can create a new named branch using git checkout -b name.