Skip to content

Instantly share code, notes, and snippets.

View scaprile's full-sized avatar

Sergio R. Caprile scaprile

View GitHub Profile
@scaprile
scaprile / Git Subtree basics.md
Created May 23, 2021 19:13 — 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:

@scaprile
scaprile / gist:786ffd80c27e46e2d90efbd61ac944a4
Created April 27, 2020 22:24
CentOS virtual camera on an Android tablet running IP Webcam. Uses gstreamer, v4l2loopback, snd-aloop
IPWEBCAM=http://192.168.69.245:8080
DONE=`pactl list sinks short | grep -c alsa_output.hw_2_0`
if [ $DONE -eq 0 ]; then
sudo modprobe v4l2loopback
sudo modprobe snd-aloop
pactl load-module module-alsa-source device=hw:2,1 # Yes, hardcoded, sorry 'bout that
pactl load-module module-alsa-sink device=hw:2,0
fi
gst-launch-1.0 souphttpsrc location="$IPWEBCAM/video" do-timestamp=true is-live=true ! queue ! multipartdemux ! jpegdec ! videoconvert ! v4l2sink device="/dev/video1" sync=false &
gst-launch-1.0 souphttpsrc location="$IPWEBCAM/audio.wav" is-live=true ! queue ! wavparse ! audioconvert ! pulsesink device="alsa_output.hw_2_0" sync=false &

Keybase proof

I hereby claim:

  • I am scaprile on github.
  • I am scaprile (https://keybase.io/scaprile) on keybase.
  • I have a public key ASBlardEsQGrFxTMwWtMuX-Pj0aVB9h50gFJOduTkRbUggo

To claim this, I am signing this object: