I have a love/hate relationship with git, and I never seem to use the right commands. I have a PR here:
That PR is a merge from my own fork and branch:
Hereās my problem. If I do a git fetch --all and then rebase, I get changes in 3rdparty and apps that I didnāt make. Also, it is requested that you run /build/autoloaderchecker.sh and commit that change . . . but now, my branch and PR contain changes to the autoloader files.
Iāve been trying to rebase my branch all morning. Even though I only changed 5 files, my final commit has 30 files changed, 59 insertions, and 59 deletions. Wut?
Could someone list out the proper commands and the order in which they should be executed in order to properly rebase a branch on the upstream repo without including files I didnāt change? I have this problem every time I go to rebase my branches, and I never manage to get it right.
Iām doing this:
git branch [my-branchname]
git fetch --all
// Might be unnecessary
git submodule update --recursive
git rebase -i upstream/master
./build/autoloaderchecker.sh
git commit -S -a -m 'rebase'
git push origin [my-branchname] --force-with-lease
Those really arenāt complete instructions, but I think Iām still following you. Unfortunately, Iām still getting errors about 3rdparty being modified. I. Did. Not. Change. 3rdparty. This happens every time I try to rebase, and itās getting very frustrating.
On branch [branchname]
Your branch and 'origin/[branchname]' have diverged,
and have 722 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: 3rdparty (new commits)
no changes added to commit (use "git add" and/or "git commit -a")
If I run git diff --name-only HEAD HEAD~2, I get the following:
// My files
config/config.sample.php
lib/private/Files/AppData/AppData.php
lib/private/Files/Cache/LocalRootScanner.php
lib/private/SystemConfig.php
tests/lib/Files/AppData/AppDataTest.php
// I didn't touch these
apps/files_reminders/lib/Controller/ApiController.php
apps/files_reminders/openapi.json
Thank you so much for hopping on a call with me. That was extremely helpful and unexpected. For posterity sake:
// Only if you're like me and messed up your branch:
git branch [branchname]
git reset --hard [most-recent-commit]
git fetch --all
git restore 3rdparty
git rebase -i upstream/master
git push origin [branchname] --force-with-lease
If you have the time, could you explain in simple terms why 3rdparty and apps cause issues? I mean, I understand 3rdparty because theyāre submodules (shouldnāt git submodule update --recursive fix that?), but apps isnāt.