Git reset status after undo changes
I am new to Git so I am not sure how to fix my current situation.
I have a "master" repository A. I then have a clone of it as repository B.
Both happen to be on the same machine, although in the future they will
not be. A is a remote for B.
My design for this is that changes will be made to A, and B will simply
pull from upstream to update. B may have some local changes sometimes.
The issue is that I accidentally made a change on B instead of A. Before
this change, both repos were identical. The change was a revert some
images from a previous commit (taking them from "original" state to the
"correct" state), but I don't think the fact that it was a revert matters.
Then, noticing that I did it on the wrong repo, I undid what I just
reverted (setting the images to original state before I started) and
instead made the change on the "master"/upstream A.
Now, B has the original images again, and A has the newly fixed images.
The problem is that B says that it is two revisions ahead of A. It offers
me an option to push to A, but errors if I do:
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare
repository remote: error: is denied, because it will make the index and
work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard'
to match remote: error: the work tree to HEAD.
remote: error: remote: error: You can set 'receive.denyCurrentBranch'
configuration variable to remote: error: 'ignore' or 'warn' in the remote
repository to allow pushing into remote: error: its current branch;
however, this is not recommended unless you remote: error: arranged to
update its work tree to match what you pushed in some remote: error: other
way. remote: error: remote: error: To squelch this message and still keep
the default behaviour, set remote: error: 'receive.denyCurrentBranch'
configuration variable to 'refuse'. To C:\dev\jenkins-1.501 ! [remote
rejected] master -> master (branch is currently checked out)
How do I get B to not being "ahead" of A? I now have A as it is supposed
to be, and I want to simply pull the changes into B.
No comments:
Post a Comment