Skip to content

Instantly share code, notes, and snippets.

@mitechie

mitechie/git fix Secret

Last active December 31, 2015 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitechie/0285d9d0b407ba3ab97f to your computer and use it in GitHub Desktop.
Save mitechie/0285d9d0b407ba3ab97f to your computer and use it in GitHub Desktop.
It's very likely everyone will need to follow the following steps to fix their local repositories after this little issue.
Backstory:
The CI failed on a recent PR of mine. The fix was in `juju develop` so I merged `juju develop` into my branch and pushed to have CI pass. After doing this I wanted to rebase my commits in my branch but, because I had merged develop in, the rebase did not execute as intended and ended up creating duplicate commits from others when the PR was merged into `juju develop`. In an attempt to fix this Rick rebased `juju develop` to remove these extra commits. The combination of these events seems to have put everyones local fork of `juju develop` out of sync with the real one.
Fix:
To fix this issue we need to recreate your local develop branch.
Checkout master
git checkout master
Delete your local develop branch.
git branch -d develop
Create a new develop branch from master
git checkout -b develop
Make sure origin is your fork. Fetch and Pull urls should be your fork.
git remote show origin
Make sure you're in your develop branch. It will have a * beside it.
git branch
Pull down the commits from juju's develop branch
git pull juju develop
Now we want to overwrite your forks version of develop
git push origin develop -f
Your forks version of develop will now be in sync with juju's.
If you have work in progress:
Because you were likely working off the 'bad' branch we need to re-apply those changes to a good branch.
Create a new branch from the good develop
git checkout develop
git checkout -b <feature-branch>
git push origin <feature-branch>
Go into your old branch and copy down the sha's in order of the commits that you would like to apply to this new branch
git checkout <old-branch>
git log
Check the good branch out and re-apply them in order.
git checkout <feature-branch>
git cherry-pick <sha>
...
Push up to your fork
git push
If you run into any issues along the way ping Rick or I and we will help guide you through it.
Thanks
-Jeff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment