'unstable'
branch.Open your terminal and navigate to your Core3 repository:
cd ~/Core3/MMOCoreORB
Make sure you're on the unstable
branch (or the branch you intend to work on):
git checkout unstable
Before making changes, it's good practice to check the current status of your repository:
git status
This command will show you:
Make your desired changes to the files using your preferred text editor or IDE. For example, to edit config.lua
:
nano ~/Core3/MMOCoreORB/bin/conf/config.lua
(You can replace nano
with vim
, gedit
, or any editor you prefer.)
After editing, you need to stage the changes to prepare them for committing:
git add path/to/your/file1 path/to/your/file2
Example:
git add bin/conf/config.lua
git add .
This stages all modified and new files in the repository.
Commit the staged changes with a descriptive message:
git commit -m "Describe the changes you made"
Example:
git commit -m "Update server configuration settings for improved performance"
Now, fetch and merge the latest changes from the remote unstable
branch:
git pull
What Happens Here:
fatal: detected dubious ownership in repository at '/home/swgemu/Core3'
To add an exception for this directory, call:
git config --global --add safe.directory /home/swgemu/Core3
Resolve it by running:
git config --global --add safe.directory /home/swgemu/Core3
Then, try pulling again:
git pull
Sometimes, Git may encounter conflicts between your local changes and the remote updates. Here's how to handle them:
After running git pull
, Git will notify you if there are merge conflicts. You can also check the status:
git status
Conflicted files will be marked as Unmerged.
Open each conflicted file in your editor. Git marks conflicts using the following syntax:
<<<<< HEAD
Your local changes
=======
Remote changes
>>>>> [commit hash]
<<<<<
, =======
, >>>>>
) and make the necessary adjustments.After resolving conflicts, stage the files:
git add path/to/conflicted/file
Once all conflicts are resolved and staged, commit the merge:
git commit -m "Resolve merge conflicts between local changes and remote updates"
Since the CMakeLists.txt
file is located in ~/Core3/MMOCoreORB
, you need to manage the build directory within that folder.
Remove the existing build directory to ensure a clean build:
rm -rf ~/Core3/MMOCoreORB/build
rm -rf
command to avoid deleting unintended files. Double-check the path before executing.
Create a new build directory inside MMOCoreORB
and navigate into it:
mkdir ~/Core3/MMOCoreORB/build
cd ~/Core3/MMOCoreORB/build
From the new build
directory, run CMake to configure the build system with the required build type:
cmake -DCMAKE_BUILD_TYPE=Release ..
Explanation:
-DCMAKE_BUILD_TYPE=Release
: Specifies that you want to build the project in Release mode, which optimizes the code for performance...
: Tells CMake to look for the CMakeLists.txt
file in the parent directory (~/Core3/MMOCoreORB
).Compile the project using the make
command:
make -j$(nproc)
Explanation:
make
: Initiates the build process.-j$(nproc)
: Utilizes all available CPU cores to speed up compilation.If you have customized any configuration files, it's wise to back them up before rebuilding:
Backup:
cp ~/Core3/MMOCoreORB/bin/conf/config.lua ~/Core3/MMOCoreORB/bin/conf/config.lua.bak
Restore After Build (If Necessary):
If the build process overwrites your configuration files, you can restore them:
cp ~/Core3/MMOCoreORB/bin/conf/config.lua.bak ~/Core3/MMOCoreORB/bin/conf/config.lua
If the update includes changes to the database schema:
mysqldump -u [username] -p[password] swgemu > swgemu-backup.sql
Frequent commits help in tracking changes and make it easier to manage merges.
Regularly pulling updates reduces the likelihood of complex merge conflicts.
Clear commit messages make it easier to understand the history of changes.
For substantial changes, consider creating a new branch. This isolates your work and makes collaboration smoother.
Creating a New Branch:
git checkout -b my-feature-branch
Switching Back to unstable
:
git checkout unstable
Merging Your Feature Branch into unstable
:
unstable
:
git checkout unstable
git pull
git merge my-feature-branch
Before making significant changes, back up configuration files or other critical files.
If you need to switch branches or pull changes but aren't ready to commit your current changes, you can stash them temporarily:
git stash
To apply the stashed changes later:
git stash pop
To review your commit history:
git log --oneline
To see what changes you've made compared to the last commit:
git diff
If there are files you don't want Git to track, add them to a .gitignore
file.