*** Git *** .. toctree:: :hidden: :maxdepth: 1 github Git Command Reference ===================== Configuration ------------- - Global git settings - stored in ``~/.gitconfig``:: $ git config --global user.name "My Name" $ git config --global user.emal "my@email.xyz" - Per repository settings - stored in ``.git/config``:: $ git config user.name "My Name" $ git config user.email "my@email.xyz" Branches -------- - Switch to an existing branch:: $ git checkout - Create a new branch and check it out:: $ git checkout -b Remotes ------- - List all remotes:: $ git remote -v - Rename a remote:: $ git remote rename Revert Changes -------------- - Create new changes that roll back the changes from a specific older commit:: $ git revert Git How-Tos =========== How to Split Out a Folder Into a Separate Repository ---------------------------------------------------- ... and keep the *git* history! Very heavily based on https://ao.ms/how-to-split-a-subdirectory-to-a-new-git-repository-and-keep-the-history/ 1. Make a duplicate clone of the old repository. This copy of the repository will eventually become the new repository that holds only the selected folder that is split out. If there is a copy of the old repository sitting in the same directory, direct the duplicate clone to a folder with a different name (``):: $ git clone $ cd 2. Check out the appropriate branch:: $ git checkout 3. Filter to keep only the contents of the desired folder:: $ fit filter-branch --prune-empty --subdirectory-filter 4. Create a new *git* repository at your hoser of choice. This will be the new repository holding only the desired folder. 5. Configure the new repository as the remote:: $ git remote set-url origin 6. Push the contents of the new repository:: $ git push -u origin 7. Optionally, delete the folder from the old repository