Dev local test remote by github and arc
If you are coding with some modern IDE in laptop (e.g. macbook) and testing in remote machine (e.g. EC2), hope this would be helpful for you!
The key problem is about copying code from local machine to remote. If you can write a smart script and copy the changed files to remote machine, that would be awesome! Or you can also use some FTP based tool if available.
This doc is discussing a git based solution. The key idea is to push local code into github non-master branch, then the remote machine pulls code and does testing.
https://medium.com/@marslenjoy
The local code change is in “local_branch1” branch, the remote testing code is in “remote_branch1” branch. The big picture above shows the flow from “local_branch1” in local to “remote_branch1” in remote.
In local machine (e.g. your laptop)
Sync up your local branch with master (if necessary)
git fetch origin master && git rebase -i origin/master
NOTE: Unfortunately you can’t simply git push
your local_branch1
to remote origin github because, the arc
CR will be merged to non-master branch remotely, that's probably not what you want.
Background about arc: https://secure.phabricator.com/book/phabricator/article/arcanist/
Alternatively, you have to clone a new branch same as the local_branch1
, then push to origin github, and the remote machine can pull the code. Just simply delete the “remote_branch1” branch and create a new one with same name again and again.
In summary, just run the command line in local branch:
REMOTE=remote_branch1 LOCAL=local_branch1; \
git push origin --delete $REMOTE && git branch -D $REMOTE \
&& git checkout master && git pull \
&& git merge --squash $LOCAL \
&& git checkout -b $REMOTE \
&& git commit -a -m "debug1" \
&& git push --set-upstream origin $REMOTE \
&& git checkout $LOCAL
In remote machine (e.g. EC2)
Remote machine just needs to be focused on pull the latest version of “remote_branch1”. To make it clean, just delete and re-sync the branch again and again.
Run the command line in remote machine:
REMOTE=remote_branch1; \
git checkout master \
&& git branch -D $REMOTE \
&& git pull \
&& git checkout $REMOTE