Skip to content

Instantly share code, notes, and snippets.

@pulkitsinghal
Last active November 9, 2017 18:35
Show Gist options
  • Save pulkitsinghal/1ab624b5b6d32a9ad680c07d9ffa79ad to your computer and use it in GitHub Desktop.
Save pulkitsinghal/1ab624b5b6d32a9ad680c07d9ffa79ad to your computer and use it in GitHub Desktop.
Simplify management by unifying projects using submodules in git

Unify

  1. Create a unified project

    mkdir ~/dev/parentProjectName && \
    cd ~/dev/parentProjectName && \
    git init && \
    git submodule add git@github.com:orgName/projA.git projA && \
    git submodule add git@github.com:orgName/projA.git projB
    
  2. Check it in: git add . && git commit -n -m "initial commit"

Deploy on Remote Box for development

  1. Link the project filesystem for 2-way sync with your remote dev box:
    1. git checkout develop

    2. Setup dropbox on remote machine

    3. Create a directory on your local machine to house any and all projects meant for remote development: mkdir -p ~/Dropbox/rDev

    4. Wire the project on your machine to your local dropbox:

      cd ~/dev/parentProjectName
      ln -s `pwd` ~/Dropbox/rDev/parentProjectName
      
    5. Make sure the sync finishes. On remoteBox run: dropbox status or ~/bin/dropbox.py status

    6. Run any commands to deploy posxdata (refer to readme) on the remoteBox in your ssh session.

    7. You should also configure your remoteBox for this project specifically and avoid syncing folders that don't matter for remote editing:

      cd ~/Dropbox/ && ~/bin/dropbox.py exclude add rDev/parentProjectName/projA/worker/node_modules/ && \
      cd ~/Dropbox/ && ~/bin/dropbox.py exclude add rDev/parentProjectName/projA/api/node_modules/ && \
      cd ~/Dropbox/ && ~/bin/dropbox.py exclude add rDev/parentProjectName/projA/api/npm-debug.log && \
      cd ~/Dropbox/ && ~/bin/dropbox.py exclude add rDev/parentProjectName/projB/node_modules/ && \
      cd ~/Dropbox/ && ~/bin/dropbox.py exclude add rDev/parentProjectName/projB/app/bower_components/ && \
      cd ~/Dropbox/ && ~/bin/dropbox.py exclude add rDev/parentProjectName/projC/vendor/ && \
      cd ~/Dropbox/ && ~/bin/dropbox.py exclude add rDev/parentProjectName/projC/docker/volumes/ 
      
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment