A scalable day-trading system for "Software System Scalability" course
Optional: make a code folder in your home directory. This will simplify shared scripts.
cd ~
mkdir code
Clone the repo:
cd ~/code
git clone https://github.com/imagineer6/ScalableDayTrader_SENG468.git
A branching workflow keeps things sane when multiple devs are working on the same codebase.
- A branch should represent the smallest atomic addition of functionality (ideally).
- In order to stay up to date, rebase your branch onto
origin/master
often. - In order to keep others up to date, and reduce merge conflicts on your behalf, don't merge your branch as soon as possible, adhere to the first point (within reason).
- We will use a rebasing workflow to keep our master branch linear.
git checkout master
git fetch
# Note: make sure you are now on master, and do not have any work on master, because the next step will nuke it. Use `git stash` before-hand if you do.
git reset --hard origin/master
git checkout -b 'branch-name-goes-here'
Git performs action on files that have been placed in the staging area, which acts as a triage. To see what files are in the staging area:
git status
# To add a single file
git add some_file.py
# To add every file in the current directory:
git add .
git commit -m "A <50 char title describing WHAT functionality the commit adds
An optional message body describing WHY. Note: the commit should not go into
the WHATs of specific details, as it is redundant, since this is what the commit is storing"
NOTE: Commit Message Best Practices
NOTE: Do not commit compilation artifacts, editor config files, and random junk.
git push origin branch-name
Note: We use a no-ff
merge because we have rebased onto master (so
that that our master branch stays linear), and we want to generate a merge
commit for clarity/posterity. The message has the form "Merge branch ..."
so that it is easy to spot merge commits in the log.
git checkout your-branch-to-merge
git fetch
git rebase origin/master
#Note: if you have merge conflicts at this stage, you will need to fixt them. After, repeat from the beggining.
git checkout master
# Note: make sure you are now on master and do not have any work on master, because the next step will nuke it.
git reset --hard origin/master
git merge --no-ff 'your-branch-name' -m "Merge branch 'your-branch-name'"
git push origin master
Never edit public history. You can always edit/change local and remote
history on your own branches (using commit amending, interactive rebasing,
resetting, force pushing, etc.). However, you should NEVER change history on
remote/origin/master
, and you should never edit other people's branches.
(Unless you really know what you are doing and have the author's permission).
# See log of git commits:
git log
# See branches:
git branch
# Selectively add to staging area:
git add your-file -p
# To see what parts of the file have chaged:
git diff
git diff .
gif diff your-file.py
# Interactive Rebase For Changing History (only change your own history):
git rebase -i <commit hash, ie 23lk2j34lk23lk4>
# To add changes to your last commit:
git add Changed_file.py
git commit --ammend