Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git subrepo pull/branch fails after force-pushing to remote #541

Open
nyanpasu64 opened this issue Jul 31, 2021 · 1 comment
Open

git subrepo pull/branch fails after force-pushing to remote #541

nyanpasu64 opened this issue Jul 31, 2021 · 1 comment

Comments

@nyanpasu64
Copy link

After I rewrite and force-push to a remote, I can no longer git subrepo pull --method rebase to rebase my local branch on the new remote branch.

> git subrepo pull --method rebase 3rdparty/rtaudio
git-subrepo: Local repository does not contain 72d703e77db60c9faf31a5b78ddb272d08401065. Try to 'git subrepo fetch 3rdparty/rtaudio' or add the '-F' flag to always fetch the latest content.
> git subrepo branch 3rdparty/rtaudio/
git-subrepo: Local repository does not contain 72d703e77db60c9faf31a5b78ddb272d08401065. Try to 'git subrepo fetch 3rdparty/rtaudio' or add the '-F' flag to always fetch the latest content.

72d703e77db60c9faf31a5b78ddb272d08401065 is the latest remote commit seen from a prior fetch/pull. However I have rebased the rtaudio repository on upstream and force-pushed to the remote, removing 72d703e from the master branch. Now git subrepo pull fails, even though a regular git pull --rebase is perfectly capable of rebasing onto a force-pushed remote.

git subrepo pull --force [--method rebase] 3rdparty/rtaudio works (--method rebase is ignored), but discards all changes I made locally but haven't run git subrepo push on. If I've made the changes recently and haven't pushed them to master, I have to checkout a commit from before the changes, then cherry-pick the commits after running git subrepo pull --force. If I've already pushed the commits and don't want to force-push my local repo, git subrepo pull --force forces me to lose the changes in the process (I can try to reapply them afterwards).

Currently using git subrepo 0.4.3 (latest release, basically latest commit).

@nyanpasu64
Copy link
Author

nyanpasu64 commented Jul 31, 2021

I tried "checkout a commit from before the changes, then cherry-pick the commits after running git subrepo pull --force". I can't push the commits.

Screenshot_20210730_192915


nyanpasu64@ryzen ~/code/exotracker-cpp (fix-rtaudio-pipewire)> git subrepo fetch 3rdparty/rtaudio
git-subrepo: There is already a worktree with branch subrepo/3rdparty/rtaudio.
Use the --force flag to override this check or perform a subrepo clean
to remove the worktree.
nyanpasu64@ryzen ~/code/exotracker-cpp (fix-rtaudio-pipewire) [1]> git subrepo fetch --force 3rdparty/rtaudio

git-subrepo: Invalid option '--force' for 'fetch'.

turns out you need to git subrepo clean 3rdparty/rtaudio, git subrepo fetch 3rdparty/rtaudio, then you can push.


  The `push` command accepts the `--all`, `--branch=`, `--dry-run`, `--force`,
  `--merge`, `--rebase`, `--remote=`, `--squash` and `--update` options.

and if you try --rebase or --dry-run it doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant