Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

Testing a fix for a gh-pages branch merge conflict - #455

Closed
allella wants to merge 2 commits into
freeCodeCamp:gh-pagesfrom
allella:fix/gh-page-merge
Closed

allella wants to merge 2 commits into
freeCodeCamp:gh-pagesfrom
allella:fix/gh-page-merge

Conversation

@allella

@allella allella commented Mar 16, 2021

Copy link
Copy Markdown
Contributor
  • I have read Chapter's contributing guidelines.
  • My pull request has a descriptive title (not a vague title like Update README.md).
  • [] My pull request targets the master branch of Chapter. This purposely targets the gh-pages branch

I'm checking to resolve a merge conflict client/src/modules/dashboard/Events/components/EventItem.tsx when I checked out this branch.

It may have been related to a permissions issue on my end. Or, perhaps it's something we'll have to deal regularly. Trying to figure it out.

@allella

allella commented Mar 16, 2021 •

Copy link
Copy Markdown
Contributor Author

@vkWeb I checked out the gh-pages branch again after the merge to see if I could sync up and then branch off the gh-pages.

There was a merge conflict on the client/src/modules/dashboard/Events/components/EventItem.tsx file, which was part of a commit to master between the time I opened the PR and the time you closed it.

This may have been a one-off thing, but I want to run a test and see.

I removed client/src/modules/dashboard/Events/components/EventItem.tsx from the gh-pages branch and created this PR to see what it would look like. I think it would be fine to merge this into the gh-pages branch. My main question is if we'll have to regularly deal with such things when checking out gh-pages for updates.

@allella

allella commented Mar 16, 2021

Copy link
Copy Markdown
Contributor Author

I suspect gh-pages should operate relatively independent, but when you start switching between master and gh-pages it may cause some new files on master to look like they are deleted.

A workaround may be to not mix development of the two branches in the same local directory.

The merge conflict I'm seeing is

image

@allella

allella commented Mar 16, 2021 •

Copy link
Copy Markdown
Contributor Author

For instance, I'm wondering if having a separate directory for working on the gh-pages, without master being cloned or pulled, would simplify things

mkdir chapter-ghpages
git init
git remote add origin https://github.com/allella/chapter.git
git remote add upstream https://github.com/freeCodeCamp/chapter.git
git pull upstream gh-pages
git checkout gh-pages
git branch fix/gh-pages-test
git checkout fix/gh-pages-test

and then changes could be made to the local PR branch (ex. fix/gh-pages-test), committed, and pushed to the origin

git commit -m 'Did somethings to Github pages'
git push origin fix/gh-pages-test

And then do a PR request on Github as normal, targeting the gh-pages branch.

@allella

allella commented Mar 16, 2021

Copy link
Copy Markdown
Contributor Author

This may not be necessary, but the merge conflict was unexpected, so I'm trying to figure out if we need to avoid potential merge conflicts since switching a single directory between master and gh-pages may cause some unwanted artifacts from the bulk adds and deletes.

@vkWeb

vkWeb commented Mar 16, 2021 •

Copy link
Copy Markdown
Member

@allella umm, I get it. Yeah this happens with git pull very often. Git pull stops whenever it looks like something gonna break (a merge conflict).

That's why I always personally use hard reset (like below I've shown) to get in sync with upstream.

# We are on master right now. Do git checkout for assurance.
$ git checkout master

# Fetch all resources from upstream
$ git fetch upstream

# Sync local master with upstream (optional step when you only want to work on gh-pages stuff)
$ git reset --hard upstream/master

# We are on master right now. Create and switch to a new branch.
$ git checkout -b gh-pages-fix

# Reset the branch with upstream/gh-pages
$ git reset --hard upstream/gh-pages

# Done. Continue doing your work, follow normal PR creation flow like git add, git commit, git push origin gh-pages-fix.

Actually, when we do git pull upstream gh-pages, git fetches from upstream and merges all those commits to our local gh-pages-fix branch which can raise conflicts scenario.

With git reset --hard, we make our gh-pages-fix branch point to the latest commit where upstream/gh-pages is, then it makes our working directory exactly look like what it was in that latest commit destroying everything else permanently.

So, using the commands I listed above should solve all our problems.

@vkWeb

vkWeb commented Mar 16, 2021

Copy link
Copy Markdown
Member

And when you want to review PRs, here are the commands I use: https://gist.github.com/vkWeb/dcec82b079f1edc19478ddb58b0ffc5e.

It is the simplest and the most elegant way to test PRs locally. It's just two git commands.

@allella

allella commented Mar 16, 2021

Copy link
Copy Markdown
Contributor Author

Thanks. I'll try the hard-reset. I have an alias that does that on master, but I didn't do it on the gh-pages branch.

If for some reason that still comes up with a conflict, then the steps I posted to create a new directory without the master branch checked out seemed to get around the merge conflicts as well.

@allella allella closed this Mar 16, 2021
@allella
allella deleted the fix/gh-page-merge branch March 16, 2021 18:03
@allella

allella commented Mar 17, 2021 •

Copy link
Copy Markdown
Contributor Author

Thanks @vkWeb. I haven't run through it all the way, but your suggestion makes sense and I've incorporated them into the comment on how to run SchemaSpy.

I think creating a directory without master and checking out gh-pages would also work, but it's more steps and things to remember.

I'll plan to move the SchemSpy stuff into a more formal doc once it's been validated a couple times. I'll probably be the one running it manually for now.

@vkWeb

vkWeb commented Mar 17, 2021

Copy link
Copy Markdown
Member

@allella yes that sounds good. If you run into issues then feel free to mention me anytime! 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants