- Please ensure that your git commit messages are meaningful, and contains at least the following
- Date and Time changed (yyyy-mm-dd HH:MM:SS ISO format)
- Author name
- Files changed
- New files added (if any)
- Changes made per file
- GitHub
- (Optional) Fork into your own account
-
Clone the repository
-
Using git
git clone https://github.com/Thanatisia/dev-references -
Change directory into the repository folder/directory
cd dev-references
-
-
(Optionals) Update your configuration information
- Change username
- This username will be shown when you create a Pull Request
git config user.name [username] - Change email
- This email will be shown when you create a Pull Request
- You can use any email (preferably the one you used to create the github account)
git config user.email [email]
- Change username
-
(Optionals) Set remote repository URL
- Change remote repository URL to push to
- Notes
- Change author to your username (if fork)
git remote add origin https://github.com/Thanatisia/dev-references - Notes
- Change remote repository URL to push to
- Once the Pre-Requisites and Initial Setup are completed
- You do not need to do those anymore unless you re-cloned the project
-
Pull/Fetch and merge the latest changes
- Notes
- Pull is basically an alias for 'fetch and merge'
- Pull all changes
git pull origin main - Fetch and Merge all changes
git fetch && git merge
- Notes
-
Change branch
- Notes
- This is very important, it is best practice to never push your changes to the main branch in any situation to not mess up production/delivery
- Always change to a new branch at the start of a development cycle/after you create a Pull Request and the Pull Request is accepted by the primary maintainer
- Using git checkout
- Notes
- Git checkout will create a new branch and automatically switch to the new branch
git checkout -b [new-branch-name] - Notes
- Using git branch and git switch
git branch [new-branch-name] && git switch [new-branch-name]
- Notes
- Make all changes
-
Check all changes
- Ensure that all your changes are available
- Show status of local repository
git status - List all updates made to added directories
git diff
-
Add changes (as required)
- Add all changes in all folders (including hidden files)
- Do this in the project root folder
git add * . - Add all changes in all folders (available only)
git add * - Add specific files
git add [files]
- Add all changes in all folders (including hidden files)
-
Commit Changes
- Notes
- Please ensure that your commit messages are meaningful, and to follow the above specified requirements
git commit -m "message" - Notes
-
Push changes to a branch in either your fork, or the repository branch
git push -u origin [new-branch-name]
- Create a Pull Request to merge your changes into the main branch
- Please specify the following
- Title: [Purpose]
- Body:
Author: [your-name] - New - New Files: + File-1 + ... - Updates - Files Changed - File-1 - Changes made: + Change-1 + Change-2 + Change-3 + ... - File-2 - ...
- Please specify the following
-
Switch back to main branch to prepare for a new feature
git switch main -
Delete unnecessary branches
- Notes
- To ensure you reduce the clutter on your project workspace
- Delete all unnecessary branches from your local repository
- To ensure you reduce the clutter on your project workspace
git branch -d [branch-name] - Notes