Updating the currently checked out branch may cause confusion
Maybe instead of re-adjusting the branch after each file, stage the worktree change, and hold off on committing.Then when a commit is eventually made, the reverse adjusting to propigate it to master would need to make sure to not remove files that were deleted as part of the commit, if their content is not present.Since only files touched by the commit will be reverse adjusted, it doesn't need to reverse all changes made by the original adjustment.For example, reversing the unlock adjustment might lock the file.[Alternatively, it could stay on the master branch, and only adjust the work tree and index.
There may be multiple commits made to the adjusted branch before any get applied back to the original branch.This is handled by reverse adjusting commits one at a time and rebasing the others on top., with the goal of merging origin/master into master, and updating adjusted/master.Or, it might do nothing, which would make all committed files remain unlocked.The new master branch can then be pushed out to remotes.
Search for updating the currently checked out branch may cause confusion:
[WORKTREE: Simply adjust the work tree (and index) per the adjustment.] A user's commits on the adjusted branch have to be reverse adjusted to get changes to apply to the master branch.