-
-
Notifications
You must be signed in to change notification settings - Fork 693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added includeDeepMembers #588
Conversation
Hi @qbolec, thanks for tackling this. Based on the message "This branch is out-of-date with the base branch", it looks like perhaps you made the changes on a local copy of your repo which is not up-to-date with master. Here's what I suggest you do. If you haven't added this main repo as an upstream remote: git remote add upstream https://github.com/chaijs/chai.git Then, rebase your local master onto the upstream master: git rebase upstream/master This may fail with merge conflicts. You will need to open the files which have conflicts, edit them to look like the way you want (making sure to remove the git push -f For dealing with merge conflicts, if you use Atom I would suggest checking out (merge-conflicts)[https://github.com/smashwilson/merge-conflicts], which adds a nice UI around fixing merge conflicts. If you get stuck or have questions, let us know. Thanks again for your work here. |
Another suggestion I have is to use feature branches, to avoid this kind of trouble in the future. git checkout master
git pull upstream master
git push # Not strictly necessary, but will keep your remote master up-to-date
git checkout -b <name-of-your-feature-or-issue-number> This will create a new branch, starting with the most up-to-date code from this project's master branch. Then, you can work on multiple features or issues at a time, while keeping your master branch in sync with the upstream. |
Thanks for the PR @qbolec! @IanVS gives some good advice, and also I have a little bit more for you: I'd kindly ask you to remove git rebase -i origin/master
# This will bring up an editor, which will say:
# `pick 9b8fe76 Added includeDeepMembers`.
# Change this to:
# `edit 9b8fe76 Added includeDeepMembers`.
git rm chai.js
git commit --amend
# Editor again, just save and quit
git checkout -b add-includedeepmembers
git push origin add-includedeepmembers You can read more about rebasing here: https://help.github.com/articles/about-git-rebase/ |
Thanks @keithamus and @IanVS for all your advice. My experience with svn seems to be more of a burden than a help with git. I'm still having problems with building a mental model of this whole thing :) So far I tried
I've tried to do |
I also tried |
which created some a new branch, for which the "compare changes" shows a rather disturbing removal of chai.js. I think I'll start over with a fresh repo :) |
So if you run: git remote add upstream https://github.com/chaijs/chai.git
git fetch --all
git rebase upstream/master Then you should see stuff happen. FYI, "remotes" are really just urls that are listed in your .git/config, with convenient names like "origin" and "upstream". If you [remote "origin"]
url = ... Running rebase is a way of reapplying your changes onto a different branch - the reason you're getting a noop for |
Sorry @qbolec! That was because I gave you bad advice! What I should have written was not |
Well, there is nothing to be sorry about :) |
It seems that performning
while being switched to add-includedeepmembers fixed the issue, that is now the "compare changes" shows only modifications in the two interesting files. Great. This is however achieved using two commits, and I've read somewhere that it is a good practice to squash commits before doing PR. Is it necessary? Is it even possible once I've already pushed the two commits to my github remote? |
I've tried
changed the second line to squash, tired |
You can squash if you like. To do it: git rebase -i HEAD~2 On the second commit (the one you want to squash into the other), change the git push -f The pull request should be updated automatically. |
You beat me to it. You're on the right track, just missing the force push. You can use |
Yep, the missing part was
My question now is this: should I create a new PR using the website GUI for the new branch, or should I somehow edit the PR we are currently discussing? |
@qbolec feel free to make a new PR from the |
As requested in #572 (comment) I've added the includeDeepMembers function for symmetry.
I have several doubts though:
includeDeepMembers
andincludeMembers
ignore duplicates in thesubset
argument? I'd expect the function to ignore order, but not quantity of elements to be a useful feature for some scenarios (same question forsameDeepMembers
, andsameMembers
).