alchemistry / alchemtest

the simple alchemistry test set
https://alchemtest.readthedocs.io
BSD 3-Clause "New" or "Revised" License
8 stars 12 forks source link

remove the .out format files for the invalid examples #13

Closed shuail closed 6 years ago

orbeckst commented 6 years ago

@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":

git remote -v

Probably

origin  git@github.com:shuail/alchemtest.git (fetch)
origin  git@github.com:shuail/alchemtest.git (push)

Add the main ("upstream") repo:

git remote add upstream git@github.com:alchemistry/alchemtest.git

Now reset and sync your master to where master is at the moment (there are probably smarter ways to do this...)

git reset --hard 9cabbcfd1848c8abc33757f062bdc7827168b4cb
git pull upstream master      # optional but always a good idea

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:

git checkout -b new-pr-13
git cherry-pick 6d1478b95a4fa228793fcb6f9f156600205ba507

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

(just added How do to PRs to the wiki)

shuail commented 6 years ago

@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.