Skip to content

Scheduling infrastructure for absolutely everyone.

add yarn lockfile section for contributors (#11769)

Syed Ali Shahbazb4ab710b355b
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7b477aef5f0..520107e0dc9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -161,3 +161,48 @@ If you get errors, be sure to fix them before committing.
- If your PR refers to or fixes an issue, be sure to add `refs #XXX` or `fixes #XXX` to the PR description. Replacing `XXX` with the respective issue number. See more about [Linking a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
- Be sure to fill the PR Template accordingly.
- Review [App Contribution Guidelines](./packages/app-store/CONTRIBUTING.md) when building integrations
+
+## Guidelines for committing yarn lockfile
+
+Do not commit your `yarn.lock` unless you've made changes to the `package.json`. If you've already committed `yarn.lock` unintentionally, follow these steps to undo:
+
+If your last commit has the `yarn.lock` file alongside other files and you only wish to uncommit the `yarn.lock`:
+ ```bash
+ git checkout HEAD~1 yarn.lock
+ git commit -m "Revert yarn.lock changes"
+ ```
+If you've pushed the commit with the `yarn.lock`:
+ 1. Correct the commit locally using the above method.
+ 2. Carefully force push:
+
+ ```bash
+ git push origin <your-branch-name> --force
+ ```
+
+If `yarn.lock` was committed a while ago and there have been several commits since, you can use the following steps to revert just the `yarn.lock` changes without impacting the subsequent changes:
+
+1. **Checkout a Previous Version**:
+ - Find the commit hash before the `yarn.lock` was unintentionally committed. You can do this by viewing the Git log:
+ ```bash
+ git log yarn.lock
+ ```
+ - Once you have identified the commit hash, use it to checkout the previous version of `yarn.lock`:
+ ```bash
+ git checkout <commit_hash> yarn.lock
+ ```
+
+2. **Commit the Reverted Version**:
+ - After checking out the previous version of the `yarn.lock`, commit this change:
+ ```bash
+ git commit -m "Revert yarn.lock to its state before unintended changes"
+ ```
+
+3. **Proceed with Caution**:
+ - If you need to push this change, first pull the latest changes from your remote branch to ensure you're not overwriting other recent changes:
+ ```bash
+ git pull origin <your-branch-name>
+ ```
+ - Then push the updated branch:
+ ```bash
+ git push origin <your-branch-name>
+ ```