How to work with source code
Folder Structure
It’s simply a Next.js project using Typescript, so the folder structure of the Mkdirs is as follows:
Git
How to sync the source code
If you have followed the steps in the Installation, and you have a repository named @your-github-username/your-mkdirs
.
Follow the steps below to sync the source code from @Mkdirs/mkdirs-template
to your own repository if some updates are available, for example, new features or bug fixes.
-
Add the upstream repository
First, you need to add the original repository as a remote repository.
You can name it
upstream
, and run the following command in your local repository: -
Fetch upstream changes
Run the following command to fetch all branches and commits from the original repository:
-
Switch to your main branch
Make sure you’re on your main branch (usually main or master):
-
Merge upstream changes
Now, merge the changes from the upstream main branch into your local main branch:
If you don’t want to merge all the changes from the upstream main branch, you can also cherry-pick the specific commits that you want to apply to your local main branch:
-
Resolve conflicts (if any)
If conflicts occur during the merge (mainly due to you have made some changes to the source code already), you’ll need to resolve them manually.
After resolving, use
git add
to add the modified files, then usegit commit
to commit the changes. -
Push to your own repository
Finally, push the updated local main branch to your own repository:
By following these steps, you can keep your fork in sync with the original repository. It’s recommended to perform this process regularly to ensure your fork doesn’t fall too far behind.