Git: “Not currently on any branch.” Is there an easy way to get back on a branch, while keeping the changes?

So I’ve done some work in the repository and when I’m about to commit I realize that I’m not currently on any branch. This happens a lot when working with submodules and I am able to solve it, but the process is tedious and I’ve been thinking that there must be an easier way to … Read more

Mercurial — revert back to old version and continue from there

I’m using Mercurial locally for a project (it’s the only repo there’s no pushing/pulling to/from anywhere else). To date it’s got a linear history. However, the current thing I’m working on I’ve now realized is a terrible approach and I want to go back to the version before I started it and implement it a … Read more