Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Git Cheat Sheet

Git Cheat Sheet

Extracting Repositories from Sub Paths


set -xue

projects=("subpath1" "subpath2" "subpath3" "subpath4" "subpath5")

for project in "${projects[@]}"
        rm -rf $project
        git clone $glbase/group/parent-repo.git $project
        cd $project
        git filter-branch --prune-empty --subdirectory-filter $project master
        git remote set-url origin ${glbase}/group/${project}.git
        git push origin master
        cd ..


Changing commit messages of older commits

Use git rebase -i HEAD~n where n is the number of commits that you want to go back (+1).

An editor opens up - put reword in front of every commit that you want to change, save and close the editor.

You will now be asked to edit every commit message you wanted to change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment