Skip to content

Instantly share code, notes, and snippets.

View ryandaniels's full-sized avatar
🙃

Ryan Daniels ryandaniels

🙃
View GitHub Profile
@ryandaniels
ryandaniels / profile.sh
Last active June 13, 2020 03:03 — forked from jpmens/profile.sh
tmux autostart via ssh
# .profile
...
# try to attach to tmux session or create a new one.
# Uncomment exit if you want to exit this session
# when tmux exits (e.g. detach)
if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
tmux new-session -As "t-$USER-$(hostname -s)"
@ryandaniels
ryandaniels / Git Subtree basics.md
Last active March 16, 2022 10:48 — forked from SKempin/Git Subtree basics.md
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this: