Sessions will include lecture material & coding challenges. We provide base content for you to use in your learning.
To allow us to use all of the packages and tools we might need, we need to set up our code environment:
-
Open Laragon:
-
Open the terminal (ensure you are in the
www
folder) then type the following commands:mkdir source cd source mkdir repos cd repos
-
Clone the class content into the folder using:
git clone https://github.com/NM-TAFE/dip-web-application-development-classes.git
-
Navigate back to the
www
folder:cd ../../
-
Check that npm is installed:
npm -v
-
Install the latest version:
npm install -g npm@latest
-
Check the installation worked (if updates are required):
npm -v
-
Clone the GitHub repository with the following command in your Laragon terminal:
git clone https://github.com/NM-TAFE/dip-web-application-development-classes.git
-
To get weekly updates, use:
git pull origin main
NM-TAFE/dip-web-application-development-classes: Repository for challenges and code examples for ICTWEB517 & ICTPRG546 (beginning 2024).
Note: You can also download the session code in the Blackboard shell.
To bring the latest changes from the main
branch into another branch without overwriting the work on that branch, you can use Git merge or Git rebase. Both methods will bring changes from the main
branch into your current branch, but they handle conflicts differently. Here’s a step-by-step guide for each approach:
-
Switch to the target branch (the branch where you want to bring the changes):
git checkout <your-branch>
-
Fetch the latest changes from
main
(to ensure you have the latest commits):git fetch origin
-
Merge the
main
branch into your branch:git merge origin/main
- This will merge the latest changes from the
main
branch into your current branch. - If there are conflicts, Git will notify you, and you can resolve them manually before completing the merge.
- This will merge the latest changes from the
-
Resolve any conflicts, if necessary:
- Open the conflicting files and make manual edits.
- Once resolved, mark the conflicts as resolved by adding the changes:
git add <file>
-
Complete the merge: After resolving any conflicts, complete the merge with:
git commit
Alternatively, you can rebase your branch onto the latest main
branch. This keeps your commit history cleaner, as it applies your branch’s changes on top of the latest main
branch commits.
-
Switch to the target branch:
git checkout <your-branch>
-
Fetch the latest changes from
main
:git fetch origin
-
Rebase your branch onto
main
:git rebase origin/main
- This will reapply your branch’s changes on top of the latest commits from
main
. - If there are conflicts, Git will pause the rebase and allow you to resolve them.
- This will reapply your branch’s changes on top of the latest commits from
-
Resolve any conflicts, if necessary:
- Open the conflicting files, make your changes, and then add the files:
git add <file>
- Open the conflicting files, make your changes, and then add the files:
-
Continue the rebase: After resolving conflicts, continue the rebase:
git rebase --continue
-
Force-push your branch (only if you have already pushed your branch to a remote repository):
git push --force-with-lease
- Merge is safer for preserving the original history of your branch. It creates a merge commit, showing where the two branches merged.
- Rebase results in a cleaner history, as it applies your changes on top of
main
as if they were developed after the latestmain
changes. However, it rewrites history, which can be problematic if your branch has already been pushed to a shared repository.