Git Troubleshooting | Open Library Docs
Skip to content Git Troubleshooting This guide helps you fix common git problems. For the daily workflow, see the Git Workflow Guide . If you cannot solve your problem, ask the issue's lead on the GitHub issue or on Slack. Troubleshooting If you do not understand an error, do not guess. Ask the issue's lead on the GitHub issue or on Slack. The lead can also fix your remote branch directly if necessary. Tips for what to do in common situations, such as: Rebase Fails with Merge Conflict Error PR Includes Unrelated Commits Commits Include Unrelated Changes Failing the Generate POT Check Could Not Read From Remote Repository Manual Merge Conflict Resolution Rebase Fails With Merge Conflict Error Sometimes when you try to rebase your branch after updating your master branch , you'll get an error message like this: text Auto-merging openlibrary/templates/about/team.json CONFLICT (content): Merge conflict in openlibrary/templates/about/team.json error: could not apply 447122b8d...
Switch out personal URL for team page hint: Resolve all conflicts manually, mark them as resolved with hint: "git add/rm <conflicted_files>", then run "git rebase --continue". There is a fairly simple way to resolve a conflict like this in VSCode's editor, but you first want to make 100% sure that you're dealing with an actual merge conflict , as this error can sometimes happen as a result of accidental commits on one of your branches or another out-of-date branch issue.
If this is the case, using the merge conflict resolution tools in VSCode or GitHub will only create more problems, so before starting a manual resolution, you'll want to run: sh git rebase --abort And then check in with your issue's lead to determine what steps to follow and/ or double-check to ensure you're dealing with an actual merge conflict by: Following the steps in Working on Your Branch to confirm that your master is up to date and not "ahead" by any commits before trying to rebase again.
Ensuring that your PR does not include any unrelated commits, by checking the "Outgoing" commits in the VSCode Source Control tab and/or the "Commits" tab on your PR on GitHub. If you find any, follow the steps in PR Includes Unrelated Commits . Ensuring that your commits don't include any unrelated changes, by checking the "Outgoing" changes in the VSCode Source Control tab and/or the "Files changed" tab on your PR on GitHub.
If you find any, follow the steps in Commits Include Unrelated Changes . Ensuring that you aren't getting this conflict because the pre-commit CI made some commits on your behalf. You'll see these in the "Commits" section on GitHub, and you'll want to pull them into your branch with git pull upstream name-of-your-branch before trying to rebase. After this, you'll need to run a git push -f origin HEAD to keep everything up to date.
If you've tried each of the above steps, and you're still getting the merge conflict error, you can now either contact your issue's lead for help moving forward, or begin to resolve it manually . PR Includes Unrelated Commits Sometimes if you have a look at the outgoing changes in the VSCode Source Control tab or the "Commits" in your submitted PR, you'll notice that there are other changes included along with yours that either a) you made but didn't intend to include in this PR, or b) were made by other people.
The most common reason this would happen is that you pulled in the upstream changes but forgot to push to your remote branch as well. So before proceeding, you'll want to confirm that you've pushed everything up: sh git switch master git pull --ff-only upstream master git push origin master git switch your-branch git push -f origin HEAD If you can see that the extra commits are now gone, you're good to go. If not, this means that you will need to manually remove the unneeded commits from your branch, like so: Switch to the correct branch and run the following command.
If using VSCode, it's recommended that you do this in the built-in terminal to ensure that the next few steps also happen in VSCode. sh git rebase -i master This will open a text editor that you can use to select which commits you actually want included in your PR, i.e.: text pick eb8ab51 [Your commit message] pick a18d382 [Someone else's commit you don't want] pick 76b9883 [Your commit message] # Rebase ef7d551..23961be onto ef7d551 (7 commands) To remove an unwanted commit, simply switch the text from pick to drop in the text editor and close the window.
Once this is done, you can double-check that the unwanted commits are now gone, and force-push your changes: sh git push -f origin HEAD Note: If the text editor opens in something other than VSCode and you're unsure how to close it, and/or you'd like to try some more advanced commit manipulation methods, see Commit History Manipulation to learn more. Commits Include Unrelated Changes Sometimes if you have a look at the outgoing changes in the VSCode Source Control tab or the "Files changed" in your submitted PR, you'll notice that there are a number of changes made and/or files changed that you didn't intend to include in the PR.
If you look at the commit history ("Commits" tab on GitHub) and can confirm that those changes each come from someone else's commit or a separate commit of yours that was accidentally included, you can follow the steps in PR Includes Unrelated Commits . But if you can see that the unrelated changes are actually included in commits you do want to keep, you can do the following: Ensure your master branch is up to date: sh git switch master git pull --ff-only upstream master git push origin master git switch your-branch "Soft" reset as many commits as you need, i.e.: sh git reset --soft HEAD~[number of commits to undo] This will effectively undo your commit (or commits) and return the changes to staging.
You can then undo any changes you don't want included, i.e.: In the VSCode Source Control tab: Hover over the changed file you want to undo changes to Hit the minus sign to remove it from staging Hit the reverse symbol to undo the changes Or, in the terminal: sh # Remove unwanted file from staging -- or use a . instead of filename to unstage all git restore --staged path/to/your/file # Undo changes to selected file git checkout -- path/to/your/file You can then re-commit your desired changes, and push your changes back up: sh # Add any files you want to commit back to staging if needed git add file-to-include git commit -m "Your original commit message" # Force push to overwrite the remote version git push -f origin HEAD Failing the Generate POT check If your commit involves adding, removing or altering text that will be visible to the user and is properly internationalized, an update of the translation template file will be automatically bundled in with your changes via pre-commit .
To learn more, see Pre-Commit Guide . Could Not Read from Remote Repository It may happen that when you try to pull in the upstream version of the repository, you'll get the following error: text fatal: 'upstream' does not appear to be a git repository fatal: Could not read from remote repository Please make sure you have the correct access rights and the repository exists. This just means that your branch has accidentally gotten disconnected from the OL master branch.
All you need to do to fix it is add upstream repo to list of remotes and double-check that it worked . You can then safely try pulling again to keep everything up to date. Manual Merge Conflict Resolution Note: Manual merge conflict resolution can get a little tricky, so if at any time you want to stop and ask for input from your issue's lead, you can simply run git rebase --abort to return everything to its pre-rebase state.
The lead will also be able to edit your branch for you on GitHub to resolve the conflict if necessary. A merge conflict happens when your changes conflict with other changes that have just been added to the repository. For inst
The rest of this page is on the live site.