Why does git-rebase give me merge conflicts when all I’m doing is squashing commits?

We have a Git repository with over 400 commits, the first couple dozen of which were a lot of trial-and-error. We want to clean up these commits by squashing many down into a single commit. Naturally, git-rebase seems the way to go. My problem is that it ends up with merge conflicts, and these conflicts … Read more

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

Retrieve a single file from a repository

What is the most efficient mechanism (in respect to data transferred and disk space used) to get the contents of a single file from a remote git repository? So far I’ve managed to come up with: git clone –no-checkout –depth 1 [email protected]:foo/bar.git && cd bar && git show HEAD:path/to/file.txt This still seems overkill. What about … Read more