srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/tools/git.md
diff options
context:
space:
mode:
Diffstat (limited to 'tools/git.md')
-rw-r--r--tools/git.md26
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
```
+- - -