git
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| git [2025/12/06 16:10] – created reddy | git [2026/05/02 20:13] (current) – reddy | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | |||
| + | ==== Git Remote Server ==== | ||
| + | |||
| Setting up a git server is as easy as this... | Setting up a git server is as easy as this... | ||
| Line 22: | Line 25: | ||
| git push origin main | git push origin main | ||
| </ | </ | ||
| + | |||
| + | ==== Merge between branches ==== | ||
| + | |||
| + | < | ||
| + | # Get the current branch name | ||
| + | git branch | ||
| + | git branch --show-current | ||
| + | git rev-parse --abbrev-ref HEAD # For old versions which dont have "git branch" | ||
| + | |||
| + | # Merge from main to someBranch | ||
| + | git checkout someBranch | ||
| + | git merge main | ||
| + | |||
| + | # Merge from someBranch to main | ||
| + | git checkout main | ||
| + | git merge someBranch | ||
| + | |||
| + | # Set upstream branch for local branch | ||
| + | git push --set-upstream origin someBranch | ||
| + | </ | ||
| + | |||
| + | ==== Sub Module ==== | ||
| + | |||
| + | A sub module creates a link to another Git repository. | ||
| + | |||
| + | < | ||
| + | # Allow the use of file paths | ||
| + | git config --global protocol.file.allow always | ||
| + | |||
| + | # Add the other repo as a submodule | ||
| + | git submodule add / | ||
| + | |||
| + | # Subsequently, | ||
| + | git submodule update --remote | ||
| + | |||
| + | # When someone wants to clone the parent repo | ||
| + | git -c protocol.file.allow=always clone --recurse-submodules / | ||
| + | </ | ||
| + | |||
| + | ==== Sub Tree ==== | ||
| + | |||
| + | A subtree is essentially a copy. The parent repository does not have any reference to the path of the child repository (therefore all the "git subtree" | ||
| + | |||
| + | < | ||
| + | # Add/ | ||
| + | git subtree add/ | ||
| + | </ | ||
| + | |||
| + | ==== Git Checkout Subdirectory ==== | ||
| + | |||
| + | < | ||
| + | git clone --no-checkout --depth=1 --filter=tree: | ||
| + | cd test-git-partial-clone-big-small-no-bigtree | ||
| + | git sparse-checkout set --no-cone /subdir1 /subdir2 /subdir3 | ||
| + | git checkout | ||
| + | </ | ||
| + | |||
git.1765033804.txt.gz · Last modified: by reddy
