srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2022-12-17 22:36:54 +0200
committersrdusr <[email protected]>2022-12-17 22:36:54 +0200
commit9dee1fdfb818de20b9cc0f175274ce99854cd98b (patch)
tree4b073812611d4a86e94c9b1296e12abed7b7177b /tools
parent3f9c1d944c2955eda597a4cc8d8b99830b8035b5 (diff)
downloadnotes-9dee1fdfb818de20b9cc0f175274ce99854cd98b.tar.gz
notes-9dee1fdfb818de20b9cc0f175274ce99854cd98b.zip
Add reset commits and toggle unrelated-histories
Diffstat (limited to 'tools')
-rw-r--r--tools/git.md23
1 files changed, 18 insertions, 5 deletions
diff --git a/tools/git.md b/tools/git.md
index 99f1dad..f3c6122 100644
--- a/tools/git.md
+++ b/tools/git.md
@@ -69,24 +69,37 @@
- - -
## Basic commands
-Intialize a git repository in the root of the folder.
+Intialize a git repository in the root of the folder:
```bash
$ git init
```
-See which files git knows exist.
+See which files git knows exist:
```bash
$ git status
```
-Add a new file to the repo.
+Add a new file to the repo:
```bash
$ git add <file>
```
-Create a commit with a message about the commit.
+Create a commit with a message about the commit:
```bash
$ git commit -m <file>
```
-Push the changes/commits to our repo.
+Push the changes/commits to a repo:
```bash
$ git push -u origin main
```
+Delete the most recent commit, keeping the work you've done:
+```bash
+$ git reset --soft origin/main
+```
+Delete the most recent commit, destroying the work you've done:
+```bash
+$ git reset --hard origin/main
+```
+Allow unrelated histories when two unrelated projects are merged/unaware of each
+other's existence:
+```bash
+$ git pull origin main --allow-unrelated-histories
+```
- - -