From e2d3ee01167abc66faeedc63cf75509d3fdd93d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Horcajo?= Date: Wed, 10 Jan 2024 13:03:40 +0100 Subject: [PATCH] *: Add repo update steps To avoid future problems with the repo, we need to add the steps to update the repo with the new changes from the upstream repo. --- UPDATE.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 UPDATE.md diff --git a/UPDATE.md b/UPDATE.md new file mode 100644 index 000000000..7ba5df522 --- /dev/null +++ b/UPDATE.md @@ -0,0 +1,43 @@ +To update your forked repository with the latest changes from the original repository (upstream), you can follow these steps using the command line. Make sure you have Git installed on your machine. Here's a step-by-step guide: + +### Step 1: Create a Backup Branch + +```bash +# Assuming you are currently on your main branch +git branch backup_branch + +# This will create a new branch named 'backup_branch' pointing to the same commit as your current branch +``` + +### Step 2: Rebase and Force Push + +Perform the rebase and force push as discussed earlier: + +```bash +# Fetch the latest changes from upstream +git fetch upstream + +# Rebase your changes on top of upstream +git rebase upstream/main + +# Resolve conflicts (if any) and continue the rebase + +# Force push to your forked repository +git push origin main --force +``` + +### Step 3: In Case of Issues, Restore from Backup + +If something goes wrong or you need to revert the changes, you can easily switch back to the backup branch: + +```bash +# Switch to the backup branch +git checkout backup_branch + +# Force push the backup branch to restore it +git push origin backup_branch --force +``` + +This way, you always have a backup branch pointing to the state before the rebase and force push. If anything unexpected happens, you can quickly switch back to the backup branch. + +Please note that force-pushing and rewriting history can have implications, especially in a collaborative environment. It's crucial to communicate such actions with your team and follow any established best practices or guidelines.