Update cheatsheets

This commit is contained in:
ivuorinen
2024-02-21 11:19:49 +00:00
parent 4e88a1b42f
commit 3d653cc7e6
4803 changed files with 127002 additions and 0 deletions

29
git-subtree Normal file
View File

@@ -0,0 +1,29 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# git subtree
> Manage project dependencies as subprojects.
> More information: <https://manpages.debian.org/latest/git-man/git-subtree.1.html>.
- Add a Git repository as a subtree:
`git subtree add --prefix={{path/to/directory/}} --squash {{repository_url}} {{branch_name}}`
- Update subtree repository to its latest commit:
`git subtree pull --prefix={{path/to/directory/}} {{repository_url}} {{branch_name}}`
- Merge recent changes up to the latest subtree commit into the subtree:
`git subtree merge --prefix={{path/to/directory/}} --squash {{repository_url}} {{branch_name}}`
- Push commits to a subtree repository:
`git subtree push --prefix={{path/to/directory/}} {{repository_url}} {{branch_name}}`
- Extract a new project history from the history of a subtree:
`git subtree split --prefix={{path/to/directory/}} {{repository_url}} -b {{branch_name}}`