from repo 's help, I found following information:
The -d/--detach option can be used to switch specified projects back to the manifest revision. This option is especially helpful if the project is currently on a topic branch, but the manifest revision is temporarily needed.
1 Can someone tell me what the situation to use the -d option?
2 Does it means I can get a working repo exactly the same as remote repository, no matter what topic you are working on.
'repo sync -d' will move the HEAD of the repositories back to those specified in the manifest file. However, any staged or working directory changes will be retained.
If you have mucked up your working directory and need to get it back in order I would do this:
repo sync -d
repo forall -c 'git reset --hard' # Remove all working directory (and staged) changes.
repo forall -c 'git clean -f -d' # Clean untracked files
This will create a pristine working folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With