Just some notes. Recently, I had to merge and organize 3 repositories as one, so here are the things I ended up doing.

Merging 2 repositories in to one with full history

In my case, the local repository (source) was project-a, and the public repository (destination) was project-b.

When I was finished merging, instead of git push -u I had to push it like so:

(where master was the branch I was targeting)

Source: http://stackoverflow.com/a/10548919

Accepting all merged changes

After doing the above, my repository was filled with conflicts. I didn’t care about the the remote changes, so I was able to just blanket accept my local changes.

In the above context, project-b (destination) is --ours, and project-a is --theirs. I used --theirs, as I wanted my local repository merged in to the public one.

Source: http://stackoverflow.com/a/16826016

Adding an empty branch

Now add/commit any change to keep it.

Source: http://bitflop.com/tutorials/how-to-create-a-new-and-empty-branch-in-git.html

Adding Multiple Origins

I haven’t done this yet, but eventually I’ll need to push code in to two separate repositories on demand.

Details: http://stackoverflow.com/a/11690868

Reverting a commit

Say you make a bad commit. You can revert the changes like so.

Source: http://stackoverflow.com/a/21718540

Just look-up the version ID of the commit you want instead, and edit it in to the above command.

Discarding changes

To discard a change, re-checkout the file.

Source: http://stackoverflow.com/a/52713

For ‘all unstaged files’ (everything??).

*shrug*