The most important thing to remember is that, as long as your code is part of a branch, you will never lose the data (code).
So, for example, let's say you've got a master branch off of which deviates a future branch. You want to add future to master now, but if something goes wrong, you don't want to lose the changes in future.
Here's our representation:
To ensure we keep the changes in future, we're going to branch future, without changing it, such that temp contain exactly the same thing:
Next, we'll graft future into master using rebase:
Once this is done and we're satisfied at what we see, we can remove the temp branch: