In this scenario we will combine the WKND and WKND-Events project. This scenario comprises of 3 parts:
Serial | Scenario | Complexity |
---|---|---|
1 | Clone and Format WKND Project | Medium |
2 | Clone and Format WKND-Events Project | Low |
3 | Merge WKND and WKND-Events Project | High |
- github.com account or a GIT repository on https://git.corp.adobe.com
- git command line or GitHub Desktop
- Cloud Ready Adobe Experience Manager
- Apache Maven (3.3.9 or newer)
- Adobe Public Maven Repository in maven settings
-
Clone WKND Sites Project
git clone --branch develop https://github.com/adobe/aem-guides-wknd.git
-
Set up an empty Git Repository
This GIT repository will be referred to as Origin
-
Open the Command Prompt or the Terminal Window.
-
Navigate using the command line to the local directory that contains cloned WKND Project
-
Execute the following commands, to delete the
.git
folder- Windows:
rmdir .git /S
- Mac
rm -R .git
- Windows:
-
Initialize the local repository and point it to the remote
Origin
GitHubgit init
git add .
git commit -m 1_commit
git remote add origin <http URL for the origin git>
e.g.git remote add origin https://github.com/varunmitra/WKND.git
git push -f origin master
-
Navigate using command line to the local directory that contains cloned WKND Project
-
Create a new directory
mkdir wknd
-
Move projects and files inside the newly created directory
git mv pom.xml all core it.launcher it.tests repository-structure ui.content.sample ui.frontend ui.content ui.apps wknd
-
Resulting folder structure will look like:
-
Create a new
pom.xml
file. -
Update the
pom.xml
file with the following code -
Add
pom.xml
to the current projectgit add pom.xml
-
Update the
pom.xml
file for thedispatcher
module with the following code -
Test project sanity by running
mvn verify
-
Commit the
GIT
Changesgit commit -m "moving wknd"
-
Push the latest changes to Remote Origin GitHub
git push -f origin master
-
Resulting GitHub will look something like:
-
Clone WKND-Events Sites Project
git clone --branch react/chapter-3 https://github.com/Adobe-Marketing-Cloud/aem-guides-wknd-events.git
-
Set up an empty Git Repository
This GIT repository will be referred to as Origin
-
Open Command Prompt or Terminal Window.
-
Navigate using command line to the local directory that contains cloned WKND-Events Project
-
Execute the following commands, to delete the
.git
folder- Windows:
rmdir .git /S
- Mac
rm -R .git
- Windows:
-
Initialize the local repository and point it to remote
Origin
GitHubgit init
git add .
git commit
git remote add origin <http URL for the origin git>
e.g.git remote add origin https://github.com/varunmitra/WKND-Events.git
git push -u origin master
-
Navigate using command line to the local directory that contains cloned WKND Project
-
Create a new directory
mkdir wknd-events
-
Move projects and files inside the newly created directory
git mv pom.xml core ui.content react-app ui.apps wknd-events
-
Resulting folder structure will look like:
-
Create a new
pom.xml
file. -
Update the
pom.xml
file with the following code -
Add
pom.xml
to the current projectgit add pom.xml
-
Test project sanity by running
mvn verify
-
Commit the
GIT
Changesgit commit -m "moving wknd-events"
-
Push the latest changes to Remote Origin GitHub
git push -u origin master
-
Resulting GitHub will look something like:
In ths section we will merge the WKND and wKND-Events Project. In order to achieve this we will follow the given steps:
- Add WKND-Events GitHub as a remote repository for WKND. This will allow us to fetch the content of WKND-Events Project and add it as a branch of WKND.
- Fetch WKND-Events Project.
- Switch the branch pointer to WKND-Events/Master branch.
- Verify the project contents.
- Switch the branch pointer back to the WKND Master branch.
- Perform a branch merge using --allow-unrelated-histories flag.
- Fix the Merge errors. Most importantly, modify the pom.xml to point to both wknd and wknd-events projects.
- Commit the changes.
- Verify the project using
mvn verify
ormvn clean install
- Push the consolidated project to Cloud Manager GitHub.
Exact Steps and Git Commands are as below:
-
Navigate using command line to the WKND project
-
Run the following commands:
git checkout master
git remote add WKND-Events <path to cloned WKND-Events Git repository>
e.g.git remote add WKND-Events https://github.com/varunmitra/WKND_Events.git
git fetch WKND-Events
git checkout -b WKND-Events WKND-Events/master
Verify the directory strcture:
For Mac :ls
For Windows:dir
git checkout master
git merge WKND-Events --allow-unrelated-histories
Fix the Merge errors. pom.xml should look something like https://gist.github.com/varunmitra/783c4944cc5c2c5294790ca85186bc00
Verify the directory strcture:
For Mac :ls
For Windows:dir
git commit -am "updating parent pom"
mvn verify
-
Add cloud manager GitHub
git remote add cm_repo <path to cloud manager git repository>
e.g.git remote add origin https://github.com/varunmitra/wknd_wknd_events.git
-
Push to Cloud Manager GitHub
git push -u cm_repo master:merge