How can I update my local repository according to the remotly repository?

Viewed 45

I did some changes and I dirty the local repository.
How can I update my local repo to be exactly like the remotly repo (and also update all the submodules)?

I thought to do git pull --rebase but I not sure if it's will give me what that I want.

1 Answers

use git fetch to sync with the remote

then delete untracked files:

git clean -xfd
git submodule foreach --recursive git clean -xfd

then reset changes:

git reset --hard origin/main #update the name branch if needed
git submodule foreach --recursive git reset --hard

Reinit submodules:

git submodule update --init --recursive

Full set:

git fetch
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
Related