srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2022-12-21 23:57:07 +0200
committersrdusr <[email protected]>2022-12-21 23:57:07 +0200
commit3a242ba45acc8c409fafd2393920af127e4c5ccd (patch)
tree16b60e534b8de3642a34aa9add855fb3156c005d /tools
parenteca5949aea86b6bebe220d81537700ff6d59aa21 (diff)
downloadnotes-3a242ba45acc8c409fafd2393920af127e4c5ccd.tar.gz
notes-3a242ba45acc8c409fafd2393920af127e4c5ccd.zip
Add more information about resetting the local main branch to remote repository
Diffstat (limited to 'tools')
-rw-r--r--tools/git.md12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/git.md b/tools/git.md
index a926b00..b79677a 100644
--- a/tools/git.md
+++ b/tools/git.md
@@ -49,6 +49,9 @@
#### 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.`
+ ```bash
+ $ config reset --hard origin/main
+ ```
Also NOTE: the prefix (subdirectory in which you will add the subtree) cannot already exist therefore delete/backup locally.
@@ -102,13 +105,14 @@ Push the changes/commits onto repo:
```bash
$ git push -u origin <branch>
```
-Delete the most recent commit, keeping the work you've done:
+Reset the local main branch to remote repository aka...
+Delete the most recent commit, destroying the work you've done:
```bash
-$ git reset --soft origin/<branch>
+$ git reset --hard origin/main
```
-Delete the most recent commit, destroying the work you've done:
+Delete the most recent commit, keeping the work you've done:
```bash
-$ git reset --hard origin/<branch>
+$ git reset --soft origin/<branch>
```
Allow unrelated histories when two unrelated projects are merged/unaware of each
other's existence: