I’m having troubles phrasing this clearly, but I’ll give it a shot.
Situation:
- I forked a Repository as my master then cloned it locally.
- Made my changes, and sent a pull request.
- The pull request has been closed, and has been “added manually”
(patch and apply).
Question:
- How do I get my local (and remote) repository back in sync with the upstream project?
- I don’t care about keeping minor differences.
- I want my code to be easily pulled in the future.
- I don’t want to lose history (mine or upstreams).
- Will the solution cause me issues with developing in the future?
Alternatives:
- is there an easier way?
- Should I just rename this branch (somehow) and start afresh?
-
- (somehow) sync the rename locally and work from a new master?
-
- Should I now forget using branches named master as this will cause me issues?
Well, the easiest thing if you don’t want to lose your history is to always create a feature branch where you work on your pull request.
In your case (if you want to keep your history), create a new branch
Then, just reset your master branch to whatever point is the upstream master branch
There you then have a clean state and your master branch will be exactly the upstream one. In the future, just always keep master branch following the upstream/master one, and work on feature branch you create to prevent collision with upstream updates.
edit:
By the way, I always prefer to have my branches named the same as the upstream. But you can also track upstream/master on another branch name. For example:
Hope this help!