Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Github] Clone one commit ahead even after pull request merged

1556621183
Laurent
Pro
Sheet Author
API Scripter
Hi, I'm not sure where to put that question, as it happens to me with both the API github and the character sheets github. Anyway. For months now, after my pull requests are merged, my clone repository still shows that it is some commit ahead of the Roll20 repository, although I didn't commit anything to my repository. Before this happened, after a pull request merge, I was just behind on some commits, so I fetched the Roll20 version, and then merged it into master, and all was fine. If I do that these days, my repository becomes a mess, and next pull request, it tries to re-commit my previously merged commits. The best way I found to deal with the current situation is to perform a git reset --hard of my repository to the Roll20 repository. That doesn't feel right, and in particular, that means I cannot commit anything before my pull requests get merged and then my repository is forced reset. So, the question are: Why? Why does the pull request merge leave me with some commits not counted as merged? Should I do something on my side after the pull request merge? Should I change the way I do my pull requests? (and why did it work for years before?) What would be a better way to synchronize back to Roll20 repository?
1556622283
Brian C.
Pro
Marketplace Creator
Compendium Curator
This is how I handle work that I want to add to a repository. I am not aware if any of this contravenes instructions from Roll20 for contributing. Fork the project to your account. Create a branch to do some work and give it a descriptive name. Use 1 branch per change to help keep diffs small. Create your PR from the branch back to the original project. Once the PR has been merged, delete the branch. Now, you will want to keep your fork (and sometimes your branch) up to date. For your purposes, the fork can be kept up to date, or you can delete the fork when you are done and re-fork the project later if you want to do more work. Most of the time work on a branch does not need to be updated from upstream unless there is a bug fix you need. In these cases, you usually want to sync your fork (branch) against upstream/master .  What this does is merge the commits from upstream (the Roll20 project) into your fork or branch. You then need to push the changes to your fork or branch after resolving any merge conflicts. It sounds like you were possibly creating a PR from upstream into your fork or branch. That would put your fork or branch ahead of the upstream project with some the commits from the PR from upstream to your fork or branch (essentially duplicate commits).
1556623985
Laurent
Pro
Sheet Author
API Scripter
Hi Brian, and thank you for answering my questions. I tried quite hard to understand you final paragraph: It sounds like you were possibly creating a PR from upstream into your fork or branch. That would put your fork or branch ahead of the upstream project with some the commits from the PR from upstream to your fork or branch (essentially duplicate commits). But I probably lack some basic understanding of git. To create my pull requests, I just click on the "New pull request" button from my fork on github. I don't know if that makes it a "PR from upstream". Does it? To clarify things, and so that you can point me to what I'm doing wrong, here is my typical workflow: I work on a local clone of my forked repository. Regularly, I commit and push my changes. When I want it pulled into the Roll20 repo, I go to my github forked repository web page, and click on the "New pull request" button. When I receive the message that the pull is merged, on my local clone, I use "git fetch upstream", then "git merge upstream/master", then "git push". Well, I used to do that. These days, I do "git fetch upstream", "git reset --hard upstream/master" and "git push --force". Then I start again changing my local clone and committing and pushing.
1556625490
Brian C.
Pro
Marketplace Creator
Compendium Curator
Ulti said: Hi Brian, and thank you for answering my questions. I tried quite hard to understand you final paragraph: It sounds like you were possibly creating a PR from upstream into your fork or branch. That would put your fork or branch ahead of the upstream project with some the commits from the PR from upstream to your fork or branch (essentially duplicate commits). But I probably lack some basic understanding of git. To create my pull requests, I just click on the "New pull request" button from my fork on github. I don't know if that makes it a "PR from upstream". Does it? To clarify things, and so that you can point me to what I'm doing wrong, here is my typical workflow: I work on a local clone of my forked repository. Regularly, I commit and push my changes. When I want it pulled into the Roll20 repo, I go to my github forked repository web page, and click on the "New pull request" button. When I receive the message that the pull is merged, on my local clone, I use "git fetch upstream", then "git merge upstream/master", then "git push". Well, I used to do that. These days, I do "git fetch upstream", "git reset --hard upstream/master" and "git push --force". Then I start again changing my local clone and committing and pushing. Opening a PR from upstream is just that, clicking the New PR button and having new changes flow into your fork or branch. It is the wrong way to do it, and when I did that, it caused my fork to permanently be a commit ahead. It sounds like you instead did a version of the instructions I posted above, albeit with some harder commands that I do not think you normally need. Without seeing your history, it is hard for me to definitively say what went wrong. My suggestion would be: Delete your fork and branches. Something is off, and it will be difficult to fix. Re-fork the project the next time you want to do some development. Create a new branch for each feature you want to add to the upstream project. Create the PR off of the branch. When the PR has been merged, delete the branch. Keep the fork up to date with the instructions in the link above. You can also keep a branch up to date with the same instructions, but that is often not necessary. That should keep things a bit more tidy.
1556629603
Laurent
Pro
Sheet Author
API Scripter
I will try that out. Many thanks again! For the record, I tried to understand what exactly has changed in the last few month, and if I believe  this post , it could be that the pulled requests were merged by someone from Roll20 using git commands, but he now uses the github interface.
1556695254
Brian C.
Pro
Marketplace Creator
Compendium Curator
Ulti said: I will try that out. Many thanks again! For the record, I tried to understand what exactly has changed in the last few month, and if I believe  this post , it could be that the pulled requests were merged by someone from Roll20 using git commands, but he now uses the github interface. You are welcome. I am not sure the linked post describes your situation. It mentions that the upstream repository in that situation is both 1 commit ahead and  1 commit behind. Your post only mentioned being 1 or more commits ahead.
1558433256
Laurent
Pro
Sheet Author
API Scripter
Well, I was not accurate enough, then. The upstream repository was indeed 1 commit ahead and many commits behind.