Hello Chapel community,
Yesterday, we rewrote a part of the Chapel language's git history,
going back about 12 days. This is a change that may affect your existing
local repositories of Chapel.
Why?
Five days ago, a large file was accidentally commited to the Chapel repository.
This file was the result of a homebrew test build. This large file caused
problems checking out Chapel in certain situations (as git is not particularly
good at handling large binary files). To help mitigate this issue, we decided
to rewrite the Git history to remove the large file from it altogether.
We understand that this change has been quite disruptive, and we
do not intend to do something like this again.
What did we do?
We rewrote the commits on main
after the one with hash
d7901801e024c26d19163e2ff095f77527933396
as of around 3:15pm Pacific Time
on January 30. This was required as Git commits include the hashes of commits
that precede them; thus, it is impossible to remove or modify a commit in Git
history and leave the subsequent commits intact.
How does this affect developers?
If your local checkout of Chapel and your outstanding PRs and branches
are older than commit d7901801e
, there should be nothing out of the ordinary
for you to do. However, if you have pulled the repository in the last 12 days,
and made new branches, you will have to do some work to make those
compatible with the current, upstream main
branch on chapel-lang/chapel
.
The message you will see if you are affected by this change is something like:
Your branch and 'upstream/main' have diverged,
and have 198 and 245 different commits each, respectively.
You only need to perform the following steps if you pulled onto main
in the last 12 days, or if you have branches forked from commits in the last
12 days.
Updating your local main
branch
To update your local main
branch with the updated history on GitHub, follow
these steps:
- Stash or otherwise preserve any changes you might've made to existing files
- e.g.,
git stash
- e.g.,
- Check out
main
in your repository:git checkout main
- Fetch the new commits from the upstream remote:
git fetch [NAME OF REMOTE]
- If you do not know the name of your upstream remote, find it by running
git remote --verbose
and finding the entry whose url points to
https://github.com/chapel-lang/chapel.git
.
- If you do not know the name of your upstream remote, find it by running
- Back up your
main
branch and then reset it to be the same as the one on GitHub:git branch main-backup git reset --hard [NAME OF REMOTE]/main
- Push your updated
main
branch to your Chapel fork:git push origin main --force-with-lease
Updating your branches
This step assumes you've already updated your main
as described in the steps
above.
- Check out your feature branch
git checkout my-branch
- Begin an interactive rebase on top of the
main
branch.
The above command will open a text editor.git rebase main -i
- Delete the lines with commit hashes:
e37bc915bd
,07658d1488
,6bd4bcee5f
,c77ffc71da
,87c24400b4
.
These should all be commits with the text "Added homebrew_ci Automation". - Save and quit the text editor.
- Push your branch to your remote.
git push origin my-branch --force-with-lease