git checkout master
git pull --rebase
to ensure master is up to dategit checkout [branch here]
- Fix the issue with your branch
git add
andgit commit -m "fix"
to commit the fix changegit rebase -i master
(if this fails you need to figure out what is conflicting with master and fix it)- Find the "fix" commit and change
pick
tof
(This will essentially merge your fix with the previous commit and pretend like the commit never happened separately) - Write your commit info out with editor of choice
- Since you've re-written history you'll need to force push the branch. Use
git push --force-with-lease origin [branch here]
. This will ensure that if someone else has made changes to the branch you won't clear out their changes and bail out safely
Created
April 5, 2018 15:29
-
-
Save cwgem/dbbe740a3dc769c2b00d3715683d39a3 to your computer and use it in GitHub Desktop.
Fixing up a post git push miss on a non-master branch
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment