Skip to content

Instantly share code, notes, and snippets.

@lupyuen
Last active December 15, 2022 00:02
Show Gist options
  • Save lupyuen/a6396ccbe9427087e73e5f29bf570eda to your computer and use it in GitHub Desktop.
Save lupyuen/a6396ccbe9427087e73e5f29bf570eda to your computer and use it in GitHub Desktop.
How to Resolve Conflicts for Downstream vs Upstream NuttX
## How to Resolve Conflicts for Downstream vs Upstream NuttX
export MERGE_BRANCH=TODO_CHANGE_THIS
cd /tmp
git clone --branch $MERGE_BRANCH https://github.com/lupyuen/nuttx
cd nuttx
git status
git checkout -b apache-master $MERGE_BRANCH
git pull https://github.com/apache/nuttx.git master
git checkout $MERGE_BRANCH
git merge --no-ff apache-master
## Download Upstream NuttX
cd ~
mkdir upstream
cd upstream
git clone --recursive https://github.com/apache/incubator-nuttx
git clone --recursive https://github.com/apache/incubator-nuttx-apps
pushd incubator-nuttx && git pull && git status && popd
pushd incubator-nuttx-apps && git pull && git status && popd
<<
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
>>
## Download Downstream Branch
cd ~
mkdir downstream
cd downstream
git clone --recursive https://github.com/lupyuen/incubator-nuttx
git clone --recursive https://github.com/lupyuen/incubator-nuttx-apps
pushd incubator-nuttx && git checkout downstream && git status && popd
pushd incubator-nuttx-apps && git checkout downstream && git status && popd
<<
On branch downstream
Your branch is up to date with 'origin/downstream'.
nothing to commit, working tree clean
>>
## Remove Merge
cd ~
rm -rf merge
## Download Downstream Branch for Merge Conflict
cd ~
mkdir merge
cd merge
git clone --recursive https://github.com/lupyuen/incubator-nuttx
git clone --recursive https://github.com/lupyuen/incubator-nuttx-apps
pushd incubator-nuttx && git checkout downstream && git pull && git status && popd
pushd incubator-nuttx-apps && git checkout downstream && git pull && git status && popd
<<
On branch downstream
Your branch is up to date with 'origin/downstream'.
nothing to commit, working tree clean
>>
## Merge Downstream Branch with Upstream
cd ~/merge
pushd incubator-nuttx && git pull https://github.com/apache/incubator-nuttx.git master ; git status && popd
pushd incubator-nuttx-apps && git pull https://github.com/apache/incubator-nuttx-apps.git master ; git status && popd
<<
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: drivers/video/isx012.c
>>
## Overwrite conflicts in Downstream Branch by Upstream version
cp \
~/upstream/incubator-nuttx/drivers/video/isx012.c \
~/downstream/incubator-nuttx/drivers/video/isx012.c
cd ~/downstream/incubator-nuttx
git add drivers/video/isx012.c
## Commit to Downstream Branch, apps before nuttx
## cd ~/downstream
## pushd incubator-nuttx-apps && git commit && git push && popd
## pushd incubator-nuttx && git commit && git push && popd
cd ~
rm -rf upstream
rm -rf downstream
rm -rf merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment