Master is it at say commit #10. However, I ended up realizing I broke something along the way that wasn't caught by tests.
I ended up going to commit #5, and then slowly re-did the dev of each commit and adjusted it continually to ensure it didn't re-cause the bug. Now I'm essentially back to commit #10, but with a number of changes that prevent the bug from happening.
I now want to create commit #11 using my changes. But when I try to push to master I get
fatal: You are not currently on a branch. To push the history leading to the current (detached HEAD) state now, use git push master HEAD:<name-of-remote-branch> Which is to be expected. But how do I actually get that to push up to my remote branch?
I tried git push origin HEAD:master but then got this:
! [rejected] HEAD -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/tomhammond/sample.git' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. Check out this branch and integrate the remote changes hint: (e.g. 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. When I do a git status I see HEAD detached from 4a74ac3
git reset [commit10Hash]to unstage your changes, thengit stashto save them for a bit,git reset --hard origin/nameofremotebranchto reset it to origin,git stash popto reapply the changes you want, thengit add .andgit commit -m "Your new changes on top of origin". You should then be able togit push origin nameofremotebranchwithout conflict