Branching and merging in Git

Workflow for branching and merging:

Use BFG to clear secret Git history

Pasted those nuclear launch codes in to a file and committed the damn thing to Git again? Well you can lose a bunch of time doing it with plain git commands or download BFG, then use these simple commands once you've pushed a clean version of the file:

Now delete your main repository and get a fresh clone from GitHub or wherever.

Split a GitHub folder in to a separate repo

You have a repository on Git called "all" and within that is a folder "folder_to_become_repo". You want to break this folder out to be a separate repository in your github account. Obviously, use your account name, not noelevans. Use these commands to make the change:

You'll be prompted for your github account name and password when you do the push. After this you have a new repo in Github containing all of the contents from the directory "folder_to_become_repo". The history has been migrated to the new repo too!

Now clone the repository in your normal workspace and it's ready to go!