-
Notifications
You must be signed in to change notification settings - Fork 1
Eti git
Oliver edited this page Oct 27, 2021
·
2 revisions
This document uses git on the command line, bash specifically. You can follow this generally using Windows (with either git-bash or some other prompt that mimics Bash)
- The
main
branch is the latest working version of the game's code. - When writing code, create a branch off of
develop
(NOTmain
) with a name following the guide below:- Feature Branch =
feature/feature-name-here
(e.g.feature/enemy-ai
) - Bug Fix Branch =
fix/bug-name
(e.g.fix/no-collision-walls
) - Beyond that, use your best judgement on branch names. If we can't tell the purpose of the branch from the name, it's not a good name.
- Feature Branch =
- Commit working code as one unit. If that consists of more than 1 file, commit all the relevant files as needed for it work. This makes reverting easier if it is ever needed.
- When done working on a branch:
- Open a pull request from your branch, into
develop
. - In the future, this will trigger an automated process that attempts to compile the project using Unity. If your branch doesn't compile, it will be blocked from being merged and you will need to fix the problems. If the branch does compile properly, your PR will be allowed to merge.
- If your branch doesn't get blocked from merging, you can merge it into
develop
. This can be done without approval, but getting a review from someone else can be very beneficial and is extremely recommended.
- Open a pull request from your branch, into
- Clone the repo (ssh key): (REPLACE
BRANCH_NAME
in the command)git clone [email protected]:Oliver-Akins/CMPT-306-Group-Game.git -b BRANCH_NAME
- Edit the code in whatever way you want.
- Commit your changes. (
git commit
)- Any new files you will need to
git add
before committing.
- Any new files you will need to
- Push your changes. (
git push
)- If git says something about being out of date, try
git pull
ing and thengit push
- If git says something about being out of date, try
- Make sure you're on the right branch. (
git status
)- If you're on the wrong branch, run
git checkout origin/BRANCH_NAME
replacingBRANCH_NAME
with the name of the branch you're wanting to work on. Confirm the change by runninggit status
again. - Atlassian Git Checkout Tutorial
- If you're on the wrong branch, run
- Pull changes.
git pull
- Edit the code in whatever way you want.
- Commit your changes. (
git commit
)- Any new files you will need to
git add
before committing.
- Any new files you will need to
- Push your changes. (
git push
)- If git says something about being out of date, try
git pull
ing and thengit push
- If git says something about being out of date, try
Merge conflicts can be handled with ease by opening the repository in Visual Studio Code
- Auto-save is good.
- Auto-add is bad. (Can't see the git diff, meaning that you don't know what you're committing to the repository with the commit)
-
git diff
is handy. -
git stash
is super handy for temporarily saving files that you want to change without copy/pasting them to another file. -
git branch
lists all local branches in your repo. -
git checkout -b BRANCH_NAME
creates a new local branch. -
git fetch
can be used to update the local repo with changes from the remote repo without downloading all of the files, branches, etc. in the repo.