diff options
| author | srdusr <[email protected]> | 2022-12-17 19:36:44 +0200 |
|---|---|---|
| committer | srdusr <[email protected]> | 2022-12-17 19:36:44 +0200 |
| commit | 3f9c1d944c2955eda597a4cc8d8b99830b8035b5 (patch) | |
| tree | 3defb349e8b17c21a592729b97eb92d98216d9de /tools | |
| parent | 4db367c1e7a4a60cc8e5f8dc274d57a15cb9e7e7 (diff) | |
| download | notes-3f9c1d944c2955eda597a4cc8d8b99830b8035b5.tar.gz notes-3f9c1d944c2955eda597a4cc8d8b99830b8035b5.zip | |
Replaced submodules with subtree
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/git.md | 26 |
1 files 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 <remote-git-repo-url> 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 <remote-git-repo-url> 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 ``` +- - - |