From 3f9c1d944c2955eda597a4cc8d8b99830b8035b5 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 17 Dec 2022 19:36:44 +0200 Subject: Replaced submodules with subtree --- tools/git.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tools/git.md b/tools/git.md index d073903..99f1dad 100644 --- a/tools/git.md +++ b/tools/git.md @@ -46,22 +46,29 @@ ```bash $ config checkout ``` -#### Use submodules to sync other repos into dotfiles - 1. Add a submodule to dotfiles - ```bash - $ config submodule add https://github.com/user/dotfiles.git .path/to/dotfiles - ``` - 2. Update submodules to sync to dotfiles +#### Use git subtree to sync other repos into dotfiles + 1. First make sure dotfiles is up-to date or commit/push/reset all changes + otherwise this error message will show: `Working tree has modifications. Cannot add.` + + 2. Add the repo's file path and it's remote url + ```bash + $ config subtree add --prefix /path/to/file main --squash + # Example: + $ config subtree add --prefix .config/nvim https://github.com/srdusr/nvim.git main --squash + ``` + + 3. Update to sync/show any changes into dotfiles (upstream repo) ```bash - $ config submodule update --init --recursive + $ config git subtree pull --prefix /path/to/file main --squash ``` - 3. Config push + + 4. Finally push onto remote repository ```bash $ config push ``` - - - -### Basic commands +## Basic commands Intialize a git repository in the root of the folder. ```bash $ git init @@ -82,3 +89,4 @@ Push the changes/commits to our repo. ```bash $ git push -u origin main ``` +- - - -- cgit v1.2.3