Skip to main content

Rewriting History

I often flesh out ideas with actual code. Most of the time this is simply a sketch exercise. Sometimes though, I work on this "sketch" enough that it becomes the "work". This is usually not an issue. However, like a sketch, I throw together ideas; jotting them down if you will. 

The current project I am working on started this way. It is now at the point where I have deliverables and glaring issues from my choices. Issues to me at least. For instance, all pieces are in one git repository. This is not a huge deal. Personally, I prefer the import, mobile, and web folders to be their own repository to keep their commits and tags cleaner.

Splitting a Repository

A quick search provided two ways to move a subfolder to a new repository. This help guide from github uses filter-branch, which comes with a warning:

git-filter-branch is riddled with gotchas resulting in various ways to easily corrupt repos or end up with a mess worse than what you started with

This did not work as well as The Easy Way described in a StackOverflow answer. Here is the run down of The Easy Way using my example repository Project-A

Change the Committing Account

Suppose I started hacking away at my keyboard, never realizing I was committing changes with the wrong git account. This sounds crazy I know. 

This article from Github provides the directions to correct the email and username using filter-branch for past commit history. Despite the dire warning, it worked! In short:

  • change the OLD_EMAIL, CORRECT_NAME, and CORRECT_EMAIL in the script below
  • paste corrected version into git bash
  • press [ENTER]
  • push to new repository on Bitbucket or Github or ??

Comments

  1. The Casino at El Cajon - Mapyro
    Find all information and 아산 출장마사지 reviews for The 전주 출장마사지 Casino at El Cajon - See all info 광주 출장안마 and directions. Find your way around the casino, find 용인 출장안마 where everything is  정읍 출장안마 Rating: 4 · ‎5 reviews

    ReplyDelete

Post a Comment