@shuail If you look at your commits you see that this contains old commits that had already been merged in PR #11. We only need 6d1478b95a4fa228793fcb6f9f156600205ba507
Fixing this PR
You need to get your copy of master back into sync with the original copy. Otherwise all your other PRs will contain weird commits that we don't want. But you want to keep 6d1478b95a4fa228793fcb6f9f156600205ba507 safe (if you don't want to redo the work.)
keep existing changes
In order to have git keep 6d1478b95a4fa228793fcb6f9f156600205ba507 around, just make a branch right now:
git branch old-pr-13
Having it in a named branch ensures that git won't garbage collect the commit when we rewrite the history of your master branch in a moment. (Everything else will probably also work if you don't do this but it's a good habit.)
getting your master branch back in sync
Make sure that you can easily talk to the master GitHub repo (in addition to your fork). Look at what you have, you should see "origin":
If everything looks good, git push and create a new PR.
cleaning up
It is informative to use gitk --all (graphical interface) to see your branches (in fact, have it open while you do the stuff above and use File / Reload to see the changes in your branches)
If all went well you don't need old-pr-13 anymore and you can delete it
git branch -D old-pr-13
(capital -D does a forced delete)
updating your GH repo
You should now make sure that your repo reflects the main repo. Either delete your fork and fork again or (easier), force-push your master
git checkout master
git push -f origin master
In the future
In the future I'd want you to create new branches for each PR. The workflow should be:
git checkout master
git pull upstream master # update from GitHub
git checkout -b issue-NNN-SUMMARY
# hack on code
git add ...
git commit ...
# hack more...
# ...
# push to a branch
git push -u origin issue-NNN-SUMMARY
# use GitHub to create a PR from the branch
@orbeckst thanks a lot for the tutorial! That's very useful. I just create another pull request from the new-pr-13 as you instructed and it looks like that PR have correct commit history.
@shuail If you look at your commits you see that this contains old commits that had already been merged in PR #11. We only need 6d1478b95a4fa228793fcb6f9f156600205ba507
Fixing this PR
You need to get your copy of master back into sync with the original copy. Otherwise all your other PRs will contain weird commits that we don't want. But you want to keep 6d1478b95a4fa228793fcb6f9f156600205ba507 safe (if you don't want to redo the work.)
keep existing changes
In order to have git keep 6d1478b95a4fa228793fcb6f9f156600205ba507 around, just make a branch right now:
Having it in a named branch ensures that git won't garbage collect the commit when we rewrite the history of your master branch in a moment. (Everything else will probably also work if you don't do this but it's a good habit.)
getting your master branch back in sync
Make sure that you can easily talk to the master GitHub repo (in addition to your fork). Look at what you have, you should see "origin":
Probably
Add the main ("upstream") repo:
Now reset and sync your master to where master is at the moment (there are probably smarter ways to do this...)
Now your master branch should look like the upstream's master's commit history https://github.com/alchemistry/alchemtest/commits/master
new branch and PR
Create a branch and add the other commit back:
If everything looks good,
git push
and create a new PR.cleaning up
It is informative to use
gitk --all
(graphical interface) to see your branches (in fact, have it open while you do the stuff above and use File / Reload to see the changes in your branches) If all went well you don't need old-pr-13 anymore and you can delete it(capital
-D
does a forced delete)updating your GH repo
You should now make sure that your repo reflects the main repo. Either delete your fork and fork again or (easier), force-push your master
In the future
In the future I'd want you to create new branches for each PR. The workflow should be:
(just added How do to PRs to the wiki)